hubstats 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +9 -0
- data/app/controllers/hubstats/deploys_controller.rb +2 -2
- data/app/controllers/hubstats/pull_requests_controller.rb +1 -1
- data/app/controllers/hubstats/repos_controller.rb +11 -34
- data/app/controllers/hubstats/teams_controller.rb +7 -6
- data/app/controllers/hubstats/users_controller.rb +1 -7
- data/app/helpers/hubstats/metrics_helper.rb +105 -0
- data/app/models/hubstats/comment.rb +2 -0
- data/app/models/hubstats/deploy.rb +15 -1
- data/app/models/hubstats/label.rb +2 -0
- data/app/models/hubstats/pull_request.rb +3 -1
- data/app/models/hubstats/repo.rb +2 -0
- data/app/models/hubstats/team.rb +2 -0
- data/app/models/hubstats/user.rb +3 -1
- data/app/views/hubstats/deploys/index.html.erb +4 -0
- data/app/views/hubstats/deploys/show.html.erb +1 -1
- data/app/views/hubstats/partials/_dashboard.html.erb +14 -0
- data/app/views/hubstats/partials/_header.html.erb +5 -5
- data/app/views/hubstats/partials/_quick_stats_one.html.erb +93 -0
- data/app/views/hubstats/partials/_quick_stats_two.html.erb +93 -0
- data/app/views/hubstats/pull_requests/show.html.erb +1 -1
- data/app/views/hubstats/repos/index.html.erb +14 -0
- data/app/views/hubstats/repos/show.html.erb +2 -2
- data/app/views/hubstats/teams/index.html.erb +3 -0
- data/app/views/hubstats/teams/show.html.erb +2 -2
- data/app/views/hubstats/users/index.html.erb +4 -14
- data/app/views/hubstats/users/show.html.erb +1 -1
- data/config/routes.rb +1 -2
- data/lib/hubstats/engine.rb +1 -0
- data/lib/hubstats/version.rb +1 -1
- data/spec/controllers/hubstats/deploys_controller_spec.rb +18 -15
- data/spec/controllers/hubstats/pull_requests_controller_spec.rb +17 -12
- data/spec/controllers/hubstats/repos_controller_spec.rb +21 -14
- data/spec/controllers/hubstats/teams_controller_spec.rb +5 -4
- data/spec/controllers/hubstats/users_controller_spec.rb +10 -9
- data/spec/factories/comment.rb +3 -1
- data/spec/factories/pull_requests.rb +5 -3
- data/spec/factories/repo.rb +1 -1
- data/spec/factories/users.rb +1 -1
- data/spec/lib/hubstats/events_handler_spec.rb +10 -3
- data/spec/lib/hubstats/github_api_spec.rb +2 -0
- data/spec/models/hubstats/comment_spec.rb +7 -15
- data/spec/models/hubstats/pull_request_spec.rb +22 -4
- data/spec/models/hubstats/team_spec.rb +1 -1
- data/spec/models/hubstats/user_spec.rb +6 -6
- metadata +7 -5
- data/app/views/hubstats/partials/_quick_addition_stats.html.erb +0 -33
- data/app/views/hubstats/partials/_quick_stats.html.erb +0 -69
- data/app/views/hubstats/repos/dashboard.html.erb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e925f69924867d0a38870e2a7727abb5a6184df1
|
4
|
+
data.tar.gz: 1de514e9df778d9103bae816e568d6d85998a1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91b2586e9b58d013738fbc730536be8ff384a24427f7c28fe9f17ebffdce6c9aa6a11ca8b9064f2063804befe6dcdd3ed4e3399c712e9c6019515af065043b52
|
7
|
+
data.tar.gz: b58ce472383f6690d647be15d05bfc51088db260bb7af39626cddf0bfa7f632ba895d781bd99fcc11707ac0a6d002c780be0ac6ba45a169e75da4bae9b3b2775
|
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#### v0.5.5
|
2
|
+
* Another attempt at fixing bug to correct updated_at timestamp
|
3
|
+
|
4
|
+
> Emma Sax: Andy Fleener: https://github.com/sportngin/hubstats/pull/83
|
5
|
+
|
6
|
+
* Adding metrics to all metric pages on Hubstats
|
7
|
+
|
8
|
+
> Emma Sax: Brian Bergstrom: https://github.com/sportngin/hubstats/pull/82
|
9
|
+
|
1
10
|
#### v0.5.4
|
2
11
|
* updated_at shouldn't change when updating teams for pull requests
|
3
12
|
|
@@ -9,7 +9,7 @@ module Hubstats
|
|
9
9
|
# Returns - the deploy data
|
10
10
|
def index
|
11
11
|
@deploys = Hubstats::Deploy.includes(:repo, :pull_requests, :user)
|
12
|
-
.belonging_to_users(params[:users]).belonging_to_repos(params[:repos])
|
12
|
+
.belonging_to_users(params[:users]).belonging_to_repos(params[:repos]).belonging_to_teams(params[:teams])
|
13
13
|
.group_by(params[:group])
|
14
14
|
.order_with_date_range(@start_date, @end_date, params[:order])
|
15
15
|
.paginate(:page => params[:page], :per_page => 15)
|
@@ -26,7 +26,7 @@ module Hubstats
|
|
26
26
|
repo = @deploy.repo
|
27
27
|
@pull_requests = @deploy.pull_requests.limit(20)
|
28
28
|
@pull_request_count = @pull_requests.length
|
29
|
-
@
|
29
|
+
@stats_row_one = {
|
30
30
|
pull_count: @pull_request_count,
|
31
31
|
net_additions: @deploy.find_net_additions,
|
32
32
|
comment_count: @deploy.find_comment_count,
|
@@ -33,7 +33,7 @@ module Hubstats
|
|
33
33
|
@comments = Hubstats::Comment.belonging_to_pull_request(params[:id]).created_in_date_range(@start_date, @end_date).limit(20)
|
34
34
|
comment_count = Hubstats::Comment.belonging_to_pull_request(params[:id]).created_in_date_range(@start_date, @end_date).count(:all)
|
35
35
|
@deploys = Hubstats::Deploy.where(id: @pull_request.deploy_id).order("deployed_at DESC")
|
36
|
-
@
|
36
|
+
@stats_row_one = {
|
37
37
|
comment_count: comment_count,
|
38
38
|
net_additions: @pull_request.additions.to_i - @pull_request.deletions.to_i,
|
39
39
|
additions: @pull_request.additions.to_i,
|
@@ -3,8 +3,8 @@ require_dependency "hubstats/application_controller"
|
|
3
3
|
module Hubstats
|
4
4
|
class ReposController < Hubstats::BaseController
|
5
5
|
|
6
|
-
# Public -
|
7
|
-
# @start_date and @end_date.
|
6
|
+
# Public - Shows all of the repos, in either alphabetical order, by filter params, or that have done things in
|
7
|
+
# github between the selected @start_date and @end_date.
|
8
8
|
#
|
9
9
|
# Returns - the repository data
|
10
10
|
def index
|
@@ -13,10 +13,14 @@ module Hubstats
|
|
13
13
|
elsif params[:id]
|
14
14
|
@repos = Hubstats::Repo.where(id: params[:id].split(",")).order("name ASC")
|
15
15
|
else
|
16
|
-
@repos = Hubstats::Repo.
|
16
|
+
@repos = Hubstats::Repo.with_all_metrics(@start_date, @end_date)
|
17
|
+
.with_id(params[:repos])
|
18
|
+
.custom_order(params[:order])
|
19
|
+
.paginate(:page => params[:page], :per_page => 15)
|
17
20
|
end
|
18
21
|
|
19
22
|
respond_to do |format|
|
23
|
+
format.html
|
20
24
|
format.json { render :json => @repos}
|
21
25
|
end
|
22
26
|
end
|
@@ -32,7 +36,7 @@ module Hubstats
|
|
32
36
|
@deploys = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_in_date_range(@start_date, @end_date).order("deployed_at DESC").limit(20)
|
33
37
|
@deploy_count = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_in_date_range(@start_date, @end_date).count(:all)
|
34
38
|
@comment_count = Hubstats::Comment.belonging_to_repo(@repo.id).created_in_date_range(@start_date, @end_date).count(:all)
|
35
|
-
@
|
39
|
+
@active_user_count = Hubstats::User.with_pulls_or_comments_or_deploys(@start_date, @end_date, @repo.id).only_active.length
|
36
40
|
@net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).sum(:additions).to_i -
|
37
41
|
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).sum(:deletions).to_i
|
38
42
|
@additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).average(:additions)
|
@@ -41,46 +45,19 @@ module Hubstats
|
|
41
45
|
stats
|
42
46
|
end
|
43
47
|
|
44
|
-
# Public - Shows all of the repositories with individual stats for each repo. Also shows the stats for all of
|
45
|
-
# the repositories within @start_date and @end_date.
|
46
|
-
#
|
47
|
-
# Returns - the stats for the entirety of Hubstats and all repos
|
48
|
-
def dashboard
|
49
|
-
@repos = Hubstats::Repo.with_all_metrics(@start_date, @end_date)
|
50
|
-
.with_id(params[:repos])
|
51
|
-
.custom_order(params[:order])
|
52
|
-
.paginate(:page => params[:page], :per_page => 15)
|
53
|
-
|
54
|
-
@user_count = Hubstats::User.with_pulls_or_comments_or_deploys(@start_date, @end_date).only_active.length
|
55
|
-
@deploy_count = Hubstats::Deploy.deployed_in_date_range(@start_date, @end_date).count(:all)
|
56
|
-
@pull_count = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).count(:all)
|
57
|
-
@comment_count = Hubstats::Comment.created_in_date_range(@start_date, @end_date).count(:all)
|
58
|
-
@net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).sum(:additions).to_i -
|
59
|
-
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).sum(:deletions).to_i
|
60
|
-
@additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).average(:additions)
|
61
|
-
@deletions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).average(:deletions)
|
62
|
-
|
63
|
-
stats
|
64
|
-
|
65
|
-
respond_to do |format|
|
66
|
-
format.html
|
67
|
-
format.json { render :json => @repos}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
48
|
# Public - Will assign all of the stats for both the show page and the dashboard page.
|
72
49
|
#
|
73
50
|
# Returns - the data in two hashes
|
74
51
|
def stats
|
75
52
|
@additions ||= 0
|
76
53
|
@deletions ||= 0
|
77
|
-
@
|
78
|
-
|
54
|
+
@stats_row_one = {
|
55
|
+
active_user_count: @active_user_count,
|
79
56
|
deploy_count: @deploy_count,
|
80
57
|
pull_count: @pull_count,
|
81
58
|
comment_count: @comment_count
|
82
59
|
}
|
83
|
-
@
|
60
|
+
@stats_row_two = {
|
84
61
|
avg_additions: @additions.round.to_i,
|
85
62
|
avg_deletions: @deletions.round.to_i,
|
86
63
|
net_additions: @net_additions
|
@@ -3,7 +3,8 @@ require_dependency "hubstats/application_controller"
|
|
3
3
|
module Hubstats
|
4
4
|
class TeamsController < Hubstats::BaseController
|
5
5
|
|
6
|
-
# Public - Shows all of the teams
|
6
|
+
# Public - Shows all of the teams in either alphabetical order, by filter params, or that have done things in
|
7
|
+
# github between the selected @start_date and @end_date.
|
7
8
|
#
|
8
9
|
# Returns - the team data
|
9
10
|
def index
|
@@ -33,10 +34,10 @@ module Hubstats
|
|
33
34
|
@pull_requests = Hubstats::PullRequest.belonging_to_team(@team.id).merged_in_date_range(@start_date, @end_date).order("updated_at DESC").limit(20)
|
34
35
|
@pull_count = Hubstats::PullRequest.belonging_to_team(@team.id).merged_in_date_range(@start_date, @end_date).count(:all)
|
35
36
|
@users = @team.users.where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).order("login ASC")
|
36
|
-
@
|
37
|
+
@active_user_count = @users.length
|
37
38
|
@comment_count = Hubstats::Comment.belonging_to_team(@users.pluck(:id)).created_in_date_range(@start_date, @end_date).count(:all)
|
38
39
|
repos_pr = @pull_requests.pluck(:repo_id)
|
39
|
-
repos_comment = Hubstats::Comment.
|
40
|
+
repos_comment = Hubstats::Comment.belonging_to_team(@users.pluck(:id)).created_in_date_range(@start_date, @end_date).pluck(:repo_id)
|
40
41
|
@repo_count = repos_pr.concat(repos_comment).uniq.count
|
41
42
|
@net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).sum(:additions).to_i -
|
42
43
|
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).sum(:deletions).to_i
|
@@ -52,13 +53,13 @@ module Hubstats
|
|
52
53
|
def stats
|
53
54
|
@additions ||= 0
|
54
55
|
@deletions ||= 0
|
55
|
-
@
|
56
|
+
@stats_row_one = {
|
56
57
|
pull_count: @pull_count,
|
57
|
-
|
58
|
+
active_user_count: @active_user_count,
|
58
59
|
comment_count: @comment_count,
|
59
60
|
repo_count: @repo_count
|
60
61
|
}
|
61
|
-
@
|
62
|
+
@stats_row_two = {
|
62
63
|
avg_additions: @additions.round.to_i,
|
63
64
|
avg_deletions: @deletions.round.to_i,
|
64
65
|
net_additions: @net_additions
|
@@ -12,11 +12,6 @@ module Hubstats
|
|
12
12
|
@users = Hubstats::User.where("login LIKE ?", "%#{params[:query]}%").order("login ASC")
|
13
13
|
elsif params[:id]
|
14
14
|
@users = Hubstats::User.where(id: params[:id].split(",")).order("login ASC")
|
15
|
-
elsif params[:repos]
|
16
|
-
@users = Hubstats::User.only_active.with_contributions(@start_date, @end_date, params[:repos])
|
17
|
-
.with_id(params[:users])
|
18
|
-
.custom_order(params[:order])
|
19
|
-
.paginate(:page => params[:page], :per_page => 15)
|
20
15
|
else
|
21
16
|
@users = Hubstats::User.only_active.with_all_metrics(@start_date, @end_date)
|
22
17
|
.with_id(params[:users])
|
@@ -55,7 +50,7 @@ module Hubstats
|
|
55
50
|
def stats
|
56
51
|
@additions ||= 0
|
57
52
|
@deletions ||= 0
|
58
|
-
@
|
53
|
+
@stats_row_one = {
|
59
54
|
pull_count: @pull_count,
|
60
55
|
deploy_count: @deploy_count,
|
61
56
|
comment_count: @comment_count,
|
@@ -64,6 +59,5 @@ module Hubstats
|
|
64
59
|
net_additions: @net_additions
|
65
60
|
}
|
66
61
|
end
|
67
|
-
|
68
62
|
end
|
69
63
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Hubstats
|
2
|
+
module MetricsHelper
|
3
|
+
|
4
|
+
# Public - Gets the number of active developers within the start date and end date
|
5
|
+
#
|
6
|
+
# Returns - the number of developers
|
7
|
+
def get_developer_count
|
8
|
+
Hubstats::User.count_active_developers(@start_date, @end_date)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Public - Gets the number of active reviewers within the start date and end date
|
12
|
+
#
|
13
|
+
# Returns - the number of reviewers
|
14
|
+
def get_reviewer_count
|
15
|
+
Hubstats::User.count_active_reviewers(@start_date, @end_date)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Public - Gets the number of deployments within the start date and end date
|
19
|
+
#
|
20
|
+
# Returns - the number of deployments
|
21
|
+
def get_deploy_count
|
22
|
+
Hubstats::Deploy.deployed_in_date_range(@start_date, @end_date).count(:all)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public - Gets the number of pull requests within the start date and end date
|
26
|
+
#
|
27
|
+
# Returns - the number of pull requests
|
28
|
+
def get_pull_count
|
29
|
+
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).count(:all)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Public - Gets the number of comments within the start date and end date
|
33
|
+
#
|
34
|
+
# Returns - the number of comments
|
35
|
+
def get_comment_count
|
36
|
+
Hubstats::Comment.created_in_date_range(@start_date, @end_date).count(:all)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Public - Gets the number of comments per reviewer within the start date and end date
|
40
|
+
#
|
41
|
+
# Returns - the number of comments per reviewer
|
42
|
+
def get_comments_per_rev
|
43
|
+
if get_reviewer_count != 0
|
44
|
+
comments_per_rev = (get_comment_count.to_f / get_reviewer_count.to_f).round(2)
|
45
|
+
else
|
46
|
+
comments_per_rev = 0
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Public - Gets the number of pull requests per developer within the start date and end date
|
51
|
+
#
|
52
|
+
# Returns - the number of pull requests per developer
|
53
|
+
def get_pulls_per_dev
|
54
|
+
if get_developer_count != 0
|
55
|
+
pulls_per_dev = (get_pull_count.to_f / get_developer_count.to_f).round(2)
|
56
|
+
else
|
57
|
+
pulls_per_dev = 0
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Public - Gets the total net additions from all pull requests within the start date and end date
|
62
|
+
#
|
63
|
+
# Returns - the net additions
|
64
|
+
def get_net_additions
|
65
|
+
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).sum(:additions).to_i -
|
66
|
+
Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).sum(:deletions).to_i
|
67
|
+
end
|
68
|
+
|
69
|
+
# Public - Gets the average number of additions from all pull requests within the start date and end date
|
70
|
+
#
|
71
|
+
# Returns - the average additions
|
72
|
+
def get_avg_additions
|
73
|
+
num = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).average(:additions) || 0
|
74
|
+
return num.round.to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
# Public - Gets the average number of deletions from all pull requests within the start date and end date
|
78
|
+
#
|
79
|
+
# Returns - the average deletions
|
80
|
+
def get_avg_deletions
|
81
|
+
num = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).average(:deletions) || 0
|
82
|
+
return num.round.to_i
|
83
|
+
end
|
84
|
+
|
85
|
+
# Public - Formats statistics for all repos/users/teams of Hubstats
|
86
|
+
#
|
87
|
+
# Returns - all of the stats in a corresponding hash
|
88
|
+
def dashboard
|
89
|
+
@stats_row_one = {
|
90
|
+
developer_count: get_developer_count,
|
91
|
+
pull_count: get_pull_count,
|
92
|
+
pulls_per_dev: get_pulls_per_dev,
|
93
|
+
deploy_count: get_deploy_count,
|
94
|
+
net_additions: get_net_additions
|
95
|
+
}
|
96
|
+
@stats_row_two = {
|
97
|
+
reviewer_count: get_reviewer_count,
|
98
|
+
comment_count: get_comment_count,
|
99
|
+
comments_per_rev: get_comments_per_rev,
|
100
|
+
avg_additions: get_avg_additions,
|
101
|
+
avg_deletions: get_avg_deletions
|
102
|
+
}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class Comment < ActiveRecord::Base
|
3
3
|
|
4
|
+
def self.record_timestamps; false; end
|
5
|
+
|
4
6
|
# Various checks that can be used to filter and find info about comments.
|
5
7
|
scope :created_in_date_range, lambda {|start_date, end_date| where("hubstats_comments.created_at BETWEEN ? AND ?", start_date, end_date)}
|
6
8
|
scope :belonging_to_pull_request, lambda {|pull_request_id| where(pull_request_id: pull_request_id)}
|
@@ -20,7 +20,15 @@ module Hubstats
|
|
20
20
|
scope :belonging_to_users, lambda {|user_id| where(user_id: user_id.split(',')) if user_id}
|
21
21
|
scope :with_repo_name, select('DISTINCT hubstats_repos.name as repo_name, hubstats_deploys.*').joins("LEFT JOIN hubstats_repos ON hubstats_repos.id = hubstats_deploys.repo_id")
|
22
22
|
scope :with_user_name, select('DISTINCT hubstats_users.login as user_name, hubstats_deploys.*').joins("LEFT JOIN hubstats_users ON hubstats_users.id = hubstats_deploys.user_id")
|
23
|
-
|
23
|
+
|
24
|
+
scope :belonging_to_teams, lambda {|teams|
|
25
|
+
if teams
|
26
|
+
team_list = Hubstats::Team.where(id: teams.split(','))
|
27
|
+
user_list = team_list.map {|team| team.users.pluck(:id)}.flatten.uniq
|
28
|
+
where(user_id: user_list.split(','))
|
29
|
+
end
|
30
|
+
}
|
31
|
+
|
24
32
|
attr_accessible :git_revision, :repo_id, :deployed_at, :user_id, :pull_request_ids
|
25
33
|
|
26
34
|
belongs_to :user
|
@@ -99,5 +107,11 @@ module Hubstats
|
|
99
107
|
end
|
100
108
|
return total_comments
|
101
109
|
end
|
110
|
+
|
111
|
+
# def belonging_to_teams(teams)
|
112
|
+
# team_list = Hubstats::Team.where(id: teams.split(','))
|
113
|
+
# user_list = team_list.map {|team| team.users.pluck(:id)}.flatten.uniq
|
114
|
+
# return in_teams(user_list)
|
115
|
+
# end
|
102
116
|
end
|
103
117
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class Label < ActiveRecord::Base
|
3
3
|
|
4
|
+
def self.record_timestamps; false; end
|
5
|
+
|
4
6
|
# Various checks that can be used to filter and find info about labels.
|
5
7
|
scope :with_ids, lambda {|pull_ids| (where("hubstats_labels_pull_requests.pull_request_id" => pull_ids))}
|
6
8
|
scope :with_state, lambda {|state| (where(state: state) unless state == 'all') if state}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class PullRequest < ActiveRecord::Base
|
3
|
+
|
4
|
+
def self.record_timestamps; false; end
|
3
5
|
|
4
6
|
# Various checks that can be used to filter, sort, and find info about pull requests.
|
5
7
|
scope :closed_in_date_range, lambda {|start_date, end_date| where("hubstats_pull_requests.closed_at BETWEEN ? AND ?", start_date, end_date)}
|
@@ -149,7 +151,7 @@ module Hubstats
|
|
149
151
|
def assign_team_from_user
|
150
152
|
user = Hubstats::User.find(self.user_id)
|
151
153
|
if user.team && user.team.id
|
152
|
-
self.
|
154
|
+
self.update_column(:team_id, user.team.id)
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
data/app/models/hubstats/repo.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class Repo < ActiveRecord::Base
|
3
3
|
|
4
|
+
def self.record_timestamps; false; end
|
5
|
+
|
4
6
|
# Various checks that can be used to filter and find info about repos.
|
5
7
|
scope :with_recent_activity, lambda {|start_date, end_date| where("hubstats_repos.updated_at BETWEEN ? AND ?", start_date, end_date).order("updated_at DESC")}
|
6
8
|
scope :with_id, lambda {|repo_id| where(id: repo_id.split(',')) if repo_id}
|
data/app/models/hubstats/team.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class Team < ActiveRecord::Base
|
3
3
|
|
4
|
+
def self.record_timestamps; false; end
|
5
|
+
|
4
6
|
scope :with_id, lambda {|team_id| where(id: team_id.split(',')) if team_id}
|
5
7
|
|
6
8
|
# Public - Counts all of the comments a selected team's members have written that occurred between the start_date and end_date.
|
data/app/models/hubstats/user.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Hubstats
|
2
2
|
class User < ActiveRecord::Base
|
3
3
|
|
4
|
+
def self.record_timestamps; false; end
|
5
|
+
|
4
6
|
# Various checks that can be used to filter and find info about users.
|
5
7
|
scope :with_id, lambda {|user_id| where(id: user_id.split(',')) if user_id}
|
6
8
|
scope :only_active, having("comment_count > 0 OR pull_request_count > 0 OR deploy_count > 0")
|
@@ -163,7 +165,7 @@ module Hubstats
|
|
163
165
|
|
164
166
|
attr_accessible :login, :id, :avatar_url, :gravatar_id, :url, :html_url, :followers_url,
|
165
167
|
:following_url, :gists_url, :starred_url, :subscriptions_url, :organizations_url,
|
166
|
-
:repos_url, :events_url, :received_events_url, :role, :site_admin
|
168
|
+
:repos_url, :events_url, :received_events_url, :role, :site_admin, :created_at, :updated_at
|
167
169
|
|
168
170
|
validates :id, presence: true, uniqueness: true
|
169
171
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</h4>
|
14
14
|
|
15
15
|
<!--Show the number of pull requests, comments, and net additions-->
|
16
|
-
<%= render "hubstats/partials/
|
16
|
+
<%= render "hubstats/partials/quick_stats_one" %>
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<!--Show all of the pull requests in a "condensed" view -->
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="container" id="splash">
|
2
|
+
<div class="row text-center">
|
3
|
+
|
4
|
+
<!-- Show all of the statistics about all of the repositories and users within time frame -->
|
5
|
+
<%= render 'hubstats/partials/quick_stats_one' %>
|
6
|
+
<br>
|
7
|
+
<br>
|
8
|
+
<br>
|
9
|
+
<br>
|
10
|
+
<br>
|
11
|
+
<br>
|
12
|
+
<%= render 'hubstats/partials/quick_stats_two' %>
|
13
|
+
</div>
|
14
|
+
</div>
|