hubstats 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.markdown +1 -0
- data/app/models/hubstats/user.rb +10 -13
- data/lib/hubstats/version.rb +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmE1NjhkNzM4MjI1NDgyZjgyYWRiYTIzN2Y3NDQyNTQ5ZmU4OTFmYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjRmNzcxZTIwMDk3MTIyNGQwMDAwMGIyODFlM2Q3OGQ2NTI2MmVkMA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDg5ZWFmOGZlNmRhOTk4ZDUzZmU5ODFlNDZiMDc5NWFiZWVjYjQwMWRhYTVj
|
10
|
+
YTNlNDBmOWQ4ODExMjFjMTYxOGZmY2QyYWRjMjk1MDU2OTJlYTYwOTM5MjIy
|
11
|
+
ZjUzNjUzNWVjZWMxYWRmYmMwMjk1NDAwNDFhMjM3ZmVkNjQ1ZDA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjI3MDdjOTljNTJlMTYxZDIzM2IxYWQ5MjA0NTQzOGE4NDRiZDZmNGI4YmU1
|
14
|
+
Mjc3Mjg0NWNlNjg4MDJjODE3OWY1YjQ2YTY4ZDc4ZTk2MzI0MDk0MDBkNzM1
|
15
|
+
NjM1YmMwOTU5OTIzNmJkNGU4MDIyY2ExM2QzMTU1MGFiMDg1ZWE=
|
data/CHANGELOG.markdown
CHANGED
data/app/models/hubstats/user.rb
CHANGED
@@ -3,19 +3,16 @@ module Hubstats
|
|
3
3
|
|
4
4
|
scope :with_id, lambda {|user_id| where(id: user_id.split(',')) if user_id}
|
5
5
|
|
6
|
-
scope :merged_pulls, lambda {
|
7
|
-
where("hubstats_pull_requests.merged = '1'")
|
8
|
-
}
|
9
6
|
scope :pull_requests_count, lambda { |time|
|
10
7
|
select("hubstats_users.id as user_id")
|
11
|
-
.select("COUNT(DISTINCT hubstats_pull_requests.id) AS pull_request_count")
|
12
|
-
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}'")
|
8
|
+
.select("IFNULL(COUNT(DISTINCT hubstats_pull_requests.id),0) AS pull_request_count")
|
9
|
+
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}' AND hubstats_pull_requests.merged = '1'")
|
13
10
|
.group("hubstats_users.id")
|
14
11
|
}
|
15
12
|
scope :pull_requests_count_by_repo, lambda { |time,repo_id|
|
16
13
|
select("hubstats_users.id as user_id")
|
17
|
-
.select("COUNT(DISTINCT hubstats_pull_requests.id) AS pull_request_count")
|
18
|
-
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}' AND hubstats_pull_requests.repo_id = '#{repo_id}'")
|
14
|
+
.select("IFNULL(COUNT(DISTINCT hubstats_pull_requests.id),0) AS pull_request_count")
|
15
|
+
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}' AND hubstats_pull_requests.repo_id = '#{repo_id}' AND hubstats_pull_requests.merged = '1'")
|
19
16
|
.group("hubstats_users.id")
|
20
17
|
}
|
21
18
|
scope :comments_count, lambda { |time|
|
@@ -34,7 +31,7 @@ module Hubstats
|
|
34
31
|
select("hubstats_users.id as user_id")
|
35
32
|
.select("COUNT(DISTINCT hubstats_pull_requests.id) as reviews_count")
|
36
33
|
.joins("LEFT JOIN hubstats_comments ON hubstats_comments.user_id = hubstats_users.id AND hubstats_comments.created_at > '#{time}'")
|
37
|
-
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.id = hubstats_comments.pull_request_id AND hubstats_pull_requests.
|
34
|
+
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.id = hubstats_comments.pull_request_id AND hubstats_pull_requests.closed_at > '#{time}'")
|
38
35
|
.where("hubstats_pull_requests.user_id != hubstats_users.id")
|
39
36
|
.group("hubstats_users.id")
|
40
37
|
}
|
@@ -43,28 +40,28 @@ module Hubstats
|
|
43
40
|
select("hubstats_users.id as user_id")
|
44
41
|
.select("ROUND(IFNULL(AVG(hubstats_pull_requests.additions),0)) AS average_additions")
|
45
42
|
.select("ROUND(IFNULL(AVG(hubstats_pull_requests.deletions),0)) AS average_deletions")
|
46
|
-
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}'")
|
43
|
+
.joins("LEFT JOIN hubstats_pull_requests ON hubstats_pull_requests.user_id = hubstats_users.id AND hubstats_pull_requests.created_at > '#{time}' AND hubstats_pull_requests.merged = '1'")
|
47
44
|
.group("hubstats_users.id")
|
48
45
|
}
|
49
46
|
|
50
47
|
scope :pull_and_comment_count, lambda { |time|
|
51
48
|
select("hubstats_users.*, pull_request_count, comment_count")
|
52
|
-
.joins("LEFT JOIN (#{pull_requests_count(time).
|
49
|
+
.joins("LEFT JOIN (#{pull_requests_count(time).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
|
53
50
|
.joins("LEFT JOIN (#{comments_count(time).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
|
54
51
|
.group("hubstats_users.id")
|
55
52
|
}
|
56
53
|
|
57
54
|
scope :pull_and_comment_count_by_repo, lambda { |time,repo_id|
|
58
55
|
select("hubstats_users.*, pull_request_count, comment_count")
|
59
|
-
.joins("LEFT JOIN (#{pull_requests_count_by_repo(time,repo_id).
|
56
|
+
.joins("LEFT JOIN (#{pull_requests_count_by_repo(time,repo_id).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
|
60
57
|
.joins("LEFT JOIN (#{comments_count_by_repo(time,repo_id).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
|
61
58
|
.group("hubstats_users.id")
|
62
59
|
}
|
63
60
|
|
64
61
|
scope :with_all_metrics, lambda { |time|
|
65
62
|
select("hubstats_users.*, pull_request_count, comment_count, average_additions, average_deletions")
|
66
|
-
.joins("LEFT JOIN (#{averages(time).
|
67
|
-
.joins("LEFT JOIN (#{pull_requests_count(time).
|
63
|
+
.joins("LEFT JOIN (#{averages(time).to_sql}) AS averages ON averages.user_id = hubstats_users.id")
|
64
|
+
.joins("LEFT JOIN (#{pull_requests_count(time).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
|
68
65
|
.joins("LEFT JOIN (#{comments_count(time).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
|
69
66
|
.group("hubstats_users.id")
|
70
67
|
}
|
data/lib/hubstats/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elliot Hursh
|
@@ -14,42 +14,42 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.18
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.18
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: octokit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: will_paginate-bootstrap
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -70,56 +70,56 @@ dependencies:
|
|
70
70
|
name: rspec-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 3.0.0.beta
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.0.beta
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: shoulda-matchers
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.6'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: factory_girl_rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '4.4'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '4.4'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: faker
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '1.3'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.3'
|
125
125
|
description: Github Statistics
|
@@ -129,11 +129,11 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
132
|
+
- .gitignore
|
133
|
+
- .octopolo.yml
|
134
|
+
- .rspec
|
135
|
+
- .soyuz.yml
|
136
|
+
- .travis.yml
|
137
137
|
- CHANGELOG.markdown
|
138
138
|
- Gemfile
|
139
139
|
- MIT-LICENSE
|
@@ -284,12 +284,12 @@ require_paths:
|
|
284
284
|
- lib
|
285
285
|
required_ruby_version: !ruby/object:Gem::Requirement
|
286
286
|
requirements:
|
287
|
-
- -
|
287
|
+
- - ! '>='
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0'
|
290
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
291
|
requirements:
|
292
|
-
- -
|
292
|
+
- - ! '>='
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|