hubstats 0.4.4 → 0.5.0

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.
Files changed (70) hide show
  1. checksums.yaml +5 -13
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.markdown +5 -0
  5. data/README.md +64 -22
  6. data/app/assets/javascripts/hubstats/pull_requests.js +5 -0
  7. data/app/assets/javascripts/hubstats/select2.js +46 -3
  8. data/app/assets/javascripts/hubstats/users.js +8 -0
  9. data/app/assets/stylesheets/hubstats/application.css +5 -1
  10. data/app/controllers/hubstats/pull_requests_controller.rb +2 -3
  11. data/app/controllers/hubstats/repos_controller.rb +7 -12
  12. data/app/controllers/hubstats/teams_controller.rb +62 -0
  13. data/app/controllers/hubstats/users_controller.rb +9 -8
  14. data/app/models/hubstats/comment.rb +1 -0
  15. data/app/models/hubstats/pull_request.rb +40 -8
  16. data/app/models/hubstats/repo.rb +1 -1
  17. data/app/models/hubstats/team.rb +159 -0
  18. data/app/models/hubstats/user.rb +10 -1
  19. data/app/views/hubstats/deploys/show.html.erb +1 -4
  20. data/app/views/hubstats/partials/_comment-condensed.html.erb +1 -0
  21. data/app/views/hubstats/partials/_comment.html.erb +1 -0
  22. data/app/views/hubstats/partials/_footer.html.erb +3 -0
  23. data/app/views/hubstats/partials/_header.html.erb +5 -3
  24. data/app/views/hubstats/partials/_team.html.erb +40 -0
  25. data/app/views/hubstats/partials/_user-condensed.html.erb +6 -5
  26. data/app/views/hubstats/partials/_user.html.erb +2 -1
  27. data/app/views/hubstats/pull_requests/index.html.erb +4 -0
  28. data/app/views/hubstats/repos/dashboard.html.erb +0 -1
  29. data/app/views/hubstats/repos/show.html.erb +1 -1
  30. data/app/views/hubstats/tables/_comments-condensed.html.erb +1 -1
  31. data/app/views/hubstats/tables/_comments.html.erb +1 -1
  32. data/app/views/hubstats/tables/_deploys.html.erb +1 -1
  33. data/app/views/hubstats/tables/_grouped_deploys.html.erb +1 -1
  34. data/app/views/hubstats/tables/_grouped_pulls.html.erb +1 -1
  35. data/app/views/hubstats/tables/_pulls-condensed.html.erb +1 -1
  36. data/app/views/hubstats/tables/_pulls.html.erb +1 -1
  37. data/app/views/hubstats/tables/_repos-condensed.html.erb +1 -1
  38. data/app/views/hubstats/tables/_repos.html.erb +2 -2
  39. data/app/views/hubstats/tables/_teams.html.erb +28 -0
  40. data/app/views/hubstats/tables/_users-condensed.html.erb +1 -1
  41. data/app/views/hubstats/tables/_users.html.erb +2 -2
  42. data/app/views/hubstats/teams/index.html.erb +10 -0
  43. data/app/views/hubstats/teams/show.html.erb +28 -0
  44. data/app/views/hubstats/users/show.html.erb +2 -2
  45. data/config/routes.rb +4 -3
  46. data/db/migrate/20150706204910_create_hubstats_teams.rb +8 -0
  47. data/db/migrate/20150706205049_create_hubstats_teams_users.rb +8 -0
  48. data/db/migrate/20150713185013_add_team_id_to_prs.rb +5 -0
  49. data/hubstats.gemspec +2 -1
  50. data/lib/generators/hubstats/octokit.example.yml +3 -1
  51. data/lib/hubstats/events_handler.rb +20 -0
  52. data/lib/hubstats/github_api.rb +71 -15
  53. data/lib/hubstats/version.rb +1 -1
  54. data/lib/tasks/hubstats_tasks.rake +19 -0
  55. data/lib/tasks/populate_task.rake +35 -2
  56. data/spec/controllers/hubstats/repos_controller_spec.rb +1 -0
  57. data/spec/controllers/hubstats/teams_controller_spec.rb +39 -0
  58. data/spec/controllers/hubstats/users_controller_spec.rb +2 -0
  59. data/spec/factories/pull_requests.rb +1 -1
  60. data/spec/factories/teams.rb +24 -0
  61. data/spec/factories/users.rb +0 -1
  62. data/spec/lib/hubstats/events_handler_spec.rb +37 -7
  63. data/spec/lib/hubstats/github_api_spec.rb +55 -2
  64. data/spec/lib/hubstats_spec.rb +7 -1
  65. data/spec/models/hubstats/pull_request_spec.rb +34 -0
  66. data/spec/models/hubstats/team_spec.rb +23 -0
  67. data/spec/models/hubstats/user_spec.rb +26 -0
  68. data/test/dummy/config/initializers/octokit_patch.rb +3 -0
  69. data/test/dummy/db/schema.rb +51 -40
  70. metadata +62 -29
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWQ3YTBhNDcwNThjYzIwYTQ4OTdiZjViM2RkYzAzYmZhYzIzNDE1Yg==
5
- data.tar.gz: !binary |-
6
- NjVlNzNhYjQwNzZlNmJmMjM5Nzk0MTQzOGNkZjQwNTE4NjBiNmE4ZQ==
2
+ SHA1:
3
+ metadata.gz: ac76f0c7427aa69b1fe569a7736e653be077c6ff
4
+ data.tar.gz: 2ab26da5f449aa74f2c9f8e1d4980a2280e7ebcb
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZTdiMjlkOTY2NDdiMjc2ZDY5MTI3Njg5NjU5ZDE0OWI3MmQxMTI2NDVlOGI2
10
- MGQyYmRmODU5MjY2YTRkZGJhMjRhMDg4NjYwMjlmYmY4ODBmMTQ0ZjNiYTEx
11
- MjYwNDJhNGRlMWFkOTczZDBmNTNjN2NmZjFiN2QyNjQxOWU0OTU=
12
- data.tar.gz: !binary |-
13
- Mzk0NGU2YjZjZmEwMGUzYWQ5NjY4OGY3YWNmNThkNjA5ZmUzZWU3ZDU5MjQ0
14
- Y2E3NmVmNDNiYTM3MGIwN2E2NWMzYzNmODg5ZWEwZGU4OGZjMTFhM2ZjZWNm
15
- ZDJiYzk5MDk2OGUwYWM2ZjE5ZGRhMWU4ZjIzODY2MzNhZDA2OWI=
6
+ metadata.gz: d4b610a75cc65a56502fc1203947697d98ffcdff52104e3bd72cfb4d56a3b8f53c66506e5bed2c6ec827e76f5d6127076ce344c51339d0d0ed1d759fee64345a
7
+ data.tar.gz: 648a398af505e04760496ebab015e7da39d3b68b5831a840c1fbb8f42ed8cda798a3bef01d3603eccbc69c8a47dbd4185f9fdf6504a96f44ebaab40083850715
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ hubstats
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.2
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ #### v0.5.0
2
+ * Adding teams and team commands, team sorting, and team metrics to Hubstats
3
+
4
+ > Emma Sax, Andy Fleener: Brian Bergstrom: https://github.com/sportngin/hubstats/pull/74
5
+
1
6
  #### v0.4.4
2
7
  #### v0.4.3
3
8
  * Fixes a bug introduced in v0.4.1 that removed the config method from Hubstats
data/README.md CHANGED
@@ -3,58 +3,98 @@
3
3
  Hubstats is a rails plugin which allows you to search and monitor pull requests made across a collection of repositories. It also gives extra statistics about users and pull requests not found on GitHub.
4
4
 
5
5
  ## Setup
6
-
7
- The following setup is designed to only be used when integrating this plugin into a rails application or for when adding new migrations.
6
+ The following setup is designed to only be used when integrating this plugin into a rails application.
8
7
 
9
8
  Run `rails generate hubstats:install`.
9
+
10
+ Configure `octokit.yml` with your GitHub information (see below).
10
11
 
11
12
  Run `rake hubstats:install:migrations`.
12
13
 
13
- Run `rake hubstats:setup` to run the necessary migrations and start pulling data from Github.
14
+ Run `rake hubstats:setup` to run the necessary migrations and start pulling data from GitHub.
14
15
 
15
16
  Add 'mount Hubstats::Engine => "/hubstats"' to your apps routes file.
16
17
 
17
18
  ## Configuration
18
-
19
19
  ### Authentication
20
+ Hubstats needs GitHub credentials to access your repositories, these can be setup in one of two ways:
20
21
 
21
- Hubstats needs Github credentials to access your repos, these can be setup in one of two ways:
22
-
23
- #### Configuring the `octokit.yml`
24
-
25
- Add your GitHub API token or ClientID and Secret to `octokit.yml`.
22
+ #### GitHub API Tokens
23
+ Add your GitHub API token (called `access_token`) or ClientID and Secret to `octokit.yml`.
26
24
 
27
25
  #### Environment Variables
28
-
29
26
  Hubstats can also use OAUTH access tokens stored in ENV["GITHUB_API_TOKEN"] or for Application Authentication in ENV["CLIENT_ID"] and ENV["CLIENT_SECRET"], if for some reason you don't want to store them in `octokit.yml`.
30
27
 
31
- ### Webhooks
28
+ ### Configuring Data to be Received from GitHub
29
+ #### Organizations to Follow
30
+ Hubstats tracks certain repositories and teams that are part of an organization. Therefore, you must whitelist the specific GitHub organization to track in `octokit.yml`. The list of organizations should look something like this:
32
31
 
33
- Hubstats uses GitHub webhooks to keep itself updated. It requires you to set a secret as well as an endpoint to push to.
32
+ ```
33
+ org_list:
34
+ - sportngin
35
+ ```
36
+
37
+ #### Repositories to Follow
38
+ If you only want Hubstats to watch certain repositories, you can set it to watch a list of specific repositories in `octokit.yml`. Otherwise, the default will be for Hubstats to watch an entire organization's list of repositories. The list of repositories should look like either:
39
+
40
+ ```
41
+ repo_list:
42
+ - sportngin/repo_one
43
+ - sportngin/repo_two
44
+ - sportngin/repo_three
45
+ ```
46
+
47
+ #### Teams to Follow
48
+ If you want Hubstats to watch certain teams to give back GitHub team metrics, then you must whitelist a list of teams in the `octokit.yml`. If no list of teams is added, then there will be no team metrics. The list of teams should look something like:
49
+
50
+ ```
51
+ team_list:
52
+ - Team One
53
+ - Team Two
54
+ - Team Three
55
+ ```
56
+
57
+ Also, the GitHub API token in `octokit.yml` must be a member of all of the teams listed in order to receive webhooks and populate team data.
58
+
59
+ #### Users to Ignore
60
+ If there are specific users that should not show up on any lists or in any metrics, then they can be placed on the `ignore_users_list` part of the `octokit.yml`. This list is referenced when making the list of users in teams. The list of users to ignore should look like:
61
+
62
+ ```
63
+ ignore_users_list:
64
+ - user_login_one
65
+ - user_login_two
66
+ - user_login_three
67
+ ```
34
68
 
35
- To generate a secret run:
69
+ ### Webhooks
70
+ Hubstats uses GitHub webhooks to keep its data updated. It requires you to set a secret as well as an endpoint to push to.
36
71
 
72
+ To generate a secret run:
37
73
  ```
38
74
  ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
39
75
  ```
40
-
41
76
  Set the endpoint to be:
42
77
 
43
78
  www.yourdomain.com/hubstats/handler
44
79
 
45
- ### Repositories
46
-
47
- Hubstats needs to know what repos for it to watch. You can set it to watch either an entire organization or a list of specific repos in octokit.yml.
48
-
49
80
  ## Testing
50
-
51
- All of the automated tests are written in RSpec. Since hubstats is a plugin, not an application, we need to install the plugin into a Rails application to run. The `test` directory is a dummy rails application for manually testing the UI by serving hubstats locally. When developing and using the `test/dummy` locally, then the test will automatically sync with any updated code, so it doesn't need to be re-served when changes are made with the normal Rails application. When in the development process, one just needs to run `bundle exec rails s` once from the command line (while in `test/dummy`) to serve the plugin. http://guides.rubyonrails.org/plugins.html will give more information on the implementation of a Rails plugin.
81
+ All of the automated tests are written in RSpec. To run these tests, run the following commands, assuming that there are two already existent local databases titled `hubstats_development` and `hubstats_test`:
82
+ ```
83
+ cd test/dummy/
84
+ rake db:test:prepare
85
+ bundle exec rspec
86
+ ```
87
+ To test what Hubstats would actually look like on a web browser, we need to install the plugin into a Rails application to run. This is because Hubstats is a plugin, not an application. The `test` directory is also a dummy rails application for manually testing the UI by serving Hubstats locally. When developing and using the `test/dummy` locally, then the test will automatically sync with any updated code, so it doesn't need to be re-served when changes are made with the normal Rails application. When in the development process, one just needs to run:
88
+ ```
89
+ cd test/dummy/
90
+ bundle exec rails s
91
+ ```
92
+ to serve the plugin. http://guides.rubyonrails.org/plugins.html will give more information on the implementation of a Rails plugin.
52
93
 
53
94
  ## TL:DR
54
-
55
95
  Run `rails generate hubstats:install`.
56
96
 
57
- Configure `octokit.yml` with your Github information.
97
+ Configure `octokit.yml` with your GitHub information (see above).
58
98
 
59
99
  Run `rake hubstats:install:migrations`.
60
100
 
@@ -62,4 +102,6 @@ All of the automated tests are written in RSpec. Since hubstats is a plugin, not
62
102
 
63
103
  Add 'mount Hubstats::Engine => "/hubstats"' to your routes file.
64
104
 
105
+ <hr>
106
+
65
107
  This project rocks and uses MIT-LICENSE.
@@ -35,6 +35,11 @@ $(document).ready(function() {
35
35
  var ids = $("#users").val();
36
36
  updateQueryStringParameter(queryParameters,"users",ids);
37
37
  });
38
+
39
+ $("#teams").change(function() {
40
+ var ids = $("#teams").val();
41
+ updateQueryStringParameter(queryParameters,"teams",ids);
42
+ });
38
43
  });
39
44
 
40
45
  /**
@@ -5,6 +5,7 @@
5
5
  $(document).ready(function() {
6
6
  usersIDs = queryParameters["users"] ? queryParameters["users"].replace("%2C", ",") : "";
7
7
  reposIDs = queryParameters["repos"] ? queryParameters["repos"].replace("%2C", ",") : "";
8
+ teamsIDs = queryParameters["teams"] ? queryParameters["teams"].replace("%2C", ",") : "";
8
9
 
9
10
  $("#repos").select2({
10
11
  placeholder: "Repositories",
@@ -45,8 +46,48 @@ $(document).ready(function() {
45
46
  });
46
47
  }
47
48
  }
48
- }).select2('val', []);
49
+ }).select2('val', []);
49
50
 
51
+ $("#teams").select2({
52
+ placeholder: "Teams",
53
+ multiple: true,
54
+ ajax: {
55
+ url: getPath("team"),
56
+ dataType: 'json',
57
+ quietMillis: 100,
58
+ data: function (term) {
59
+ return {
60
+ query: term
61
+ };
62
+ },
63
+ results: function (data) {
64
+ return {
65
+ results: $.map(data, function (team) {
66
+ return {
67
+ text: team.name,
68
+ id: team.id
69
+ }
70
+ })
71
+ };
72
+ }
73
+ },
74
+ initSelection: function(element, callback) {
75
+ if (teamsIDs !== "") {
76
+ $.ajax(getPath("team"), {
77
+ data: { id: teamsIDs },
78
+ dataType: "json"
79
+ }).done(function (data) { callback(
80
+ $.map(data, function (team) {
81
+ return {
82
+ text: team.name,
83
+ id: team.id
84
+ }
85
+ })
86
+ );
87
+ });
88
+ }
89
+ }
90
+ }).select2('val', []);
50
91
 
51
92
  $("#users").select2({
52
93
  placeholder: "Users",
@@ -96,7 +137,9 @@ $(document).ready(function() {
96
137
  */
97
138
  function getPath (model) {
98
139
  if (model == 'user') {
99
- return $("#brand").attr('data-user-path');}
100
- else if (model == 'repo')
140
+ return $("#brand").attr('data-user-path');
141
+ } else if (model == 'repo') {
101
142
  return $("#brand").attr('data-repo-path');
143
+ } else if (model == 'team')
144
+ return $("#brand").attr('data-team-path');
102
145
  };
@@ -37,6 +37,14 @@ $(document).ready(function() {
37
37
  $("#deletions").on("click", function(){
38
38
  toggleOrder(queryParameters,$(this).attr('id'));
39
39
  });
40
+
41
+ $("#repocount").on("click", function(){
42
+ toggleOrder(queryParameters,$(this).attr('id'));
43
+ });
44
+
45
+ $("#usercount").on("click", function(){
46
+ toggleOrder(queryParameters,$(this).attr('id'));
47
+ });
40
48
  });
41
49
 
42
50
  /* toggleOrder
@@ -36,12 +36,14 @@
36
36
  top: 8px;
37
37
  }
38
38
 
39
+ /*For the footer*/
39
40
  .footer-main-text {
40
41
  font-size: 18px;
41
42
  color: #B0B0B0;
42
43
  text-align: center;
43
44
  }
44
45
 
46
+ /*For the footer*/
45
47
  .footer-text {
46
48
  font-size: 12px;
47
49
  color: #A0A0A0;
@@ -107,7 +109,7 @@
107
109
 
108
110
  /*For the lists of repos, pull requests, deploys, comments, and users*/
109
111
 
110
- .pulls, .comments, .users, .repos, .deploys {
112
+ .pulls, .comments, .users, .repos, .teams, .deploys {
111
113
  margin: 15px 0px 15px 0px;
112
114
  border: 1px solid #ccc;
113
115
  border-radius: 5px;
@@ -125,6 +127,7 @@
125
127
  .row .single-comment,
126
128
  .row .single-user,
127
129
  .row .single-repo,
130
+ .row .single-team,
128
131
  .row .single-deploy {
129
132
  padding:5px;
130
133
  margin: 0px;
@@ -148,6 +151,7 @@
148
151
  .single-pull > .pull-info,
149
152
  .single-user > .user-info,
150
153
  .single-repo > .repo-info,
154
+ .single-team > .team-info,
151
155
  .single-deploy > .deploy-info, {
152
156
  padding: 0px;
153
157
  }
@@ -14,8 +14,8 @@ module Hubstats
14
14
  pull_requests = PullRequest.all_filtered(params, @start_date, @end_date)
15
15
  @labels = Hubstats::Label.count_by_pull_requests(pull_requests).order("pull_request_count DESC")
16
16
 
17
- @pull_requests = Hubstats::PullRequest.includes(:user, :repo)
18
- .belonging_to_users(params[:users]).belonging_to_repos(params[:repos])
17
+ @pull_requests = Hubstats::PullRequest.includes(:user, :repo, :team)
18
+ .belonging_to_users(params[:users]).belonging_to_repos(params[:repos]).belonging_to_teams(params[:teams])
19
19
  .group_by(params[:group]).with_label(params[:label])
20
20
  .state_based_order(@start_date, @end_date, params[:state], params[:order])
21
21
  .paginate(:page => params[:page], :per_page => 15)
@@ -40,6 +40,5 @@ module Hubstats
40
40
  deletions: @pull_request.deletions.to_i
41
41
  }
42
42
  end
43
-
44
43
  end
45
44
  end
@@ -46,16 +46,10 @@ module Hubstats
46
46
  #
47
47
  # Returns - the stats for the entirety of Hubstats and all repos
48
48
  def dashboard
49
- if params[:query] ## For select 2
50
- @repos = Hubstats::Repo.where("name LIKE ?", "%#{params[:query]}%").order("name ASC")
51
- elsif params[:id]
52
- @repos = Hubstats::Repo.where(id: params[:id].split(",")).order("name ASC")
53
- else
54
- @repos = Hubstats::Repo.with_all_metrics(@start_date, @end_date)
55
- .with_id(params[:repos])
56
- .custom_order(params[:order])
57
- .paginate(:page => params[:page], :per_page => 15)
58
- end
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)
59
53
 
60
54
  @user_count = Hubstats::User.with_pulls_or_comments_or_deploys(@start_date, @end_date).only_active.length
61
55
  @deploy_count = Hubstats::Deploy.deployed_in_date_range(@start_date, @end_date).count(:all)
@@ -74,8 +68,9 @@ module Hubstats
74
68
  end
75
69
  end
76
70
 
77
- # stats
78
- # Will assign all of the stats for both the show page and the dashboard page.
71
+ # Public - Will assign all of the stats for both the show page and the dashboard page.
72
+ #
73
+ # Returns - the data in two hashes
79
74
  def stats
80
75
  @additions ||= 0
81
76
  @deletions ||= 0
@@ -0,0 +1,62 @@
1
+ require_dependency "hubstats/application_controller"
2
+
3
+ module Hubstats
4
+ class TeamsController < Hubstats::BaseController
5
+
6
+ # Public - Shows all of the teams by filter params lists them with metrics between the start date and end date.
7
+ #
8
+ # Returns - the team data
9
+ def index
10
+ if params[:query] ## For select 2
11
+ @teams = Hubstats::Team.where("name LIKE ?", "%#{params[:query]}%").order("name ASC")
12
+ elsif params[:id]
13
+ @teams = Hubstats::Team.where(id: params[:id].split(",")).order("name ASC")
14
+ else
15
+ @teams = Hubstats::Team.where(hubstats: true).with_all_metrics(@start_date, @end_date)
16
+ .with_id(params[:teams])
17
+ .custom_order(params[:order])
18
+ .paginate(:page => params[:page], :per_page => 15)
19
+ end
20
+
21
+ respond_to do |format|
22
+ format.html # index.html.erb
23
+ format.json { render :json => @teams}
24
+ end
25
+ end
26
+
27
+ # Public - Will show the specific team along with the basic stats about that team, including all users
28
+ # and merged PRs a team member has done within the @start_date and @end_date.
29
+ #
30
+ # Returns - the data of the specific team
31
+ def show
32
+ @team = Hubstats::Team.where(id: params[:id]).first
33
+ @pull_requests = Hubstats::PullRequest.belonging_to_team(@team.id).merged_in_date_range(@start_date, @end_date).order("updated_at DESC").limit(20)
34
+ @pull_count = Hubstats::PullRequest.belonging_to_team(@team.id).merged_in_date_range(@start_date, @end_date).count(:all)
35
+ @users = @team.users.where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).order("login ASC")
36
+ @user_count = @users.length
37
+ @comment_count = Hubstats::Comment.belonging_to_team(@users.pluck(:id)).created_in_date_range(@start_date, @end_date).count(:all)
38
+ @net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).sum(:additions).to_i -
39
+ Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).sum(:deletions).to_i
40
+ @additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).average(:additions)
41
+ @deletions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_team(@team.id).average(:deletions)
42
+
43
+ stats
44
+ end
45
+
46
+ # Public - Shows the basic stats for the teams show page.
47
+ #
48
+ # Returns - the data in two hashes
49
+ def stats
50
+ @additions ||= 0
51
+ @deletions ||= 0
52
+ @stats_basics = {
53
+ pull_count: @pull_count,
54
+ user_count: @user_count,
55
+ comment_count: @comment_count,
56
+ avg_additions: @additions.round.to_i,
57
+ avg_deletions: @deletions.round.to_i,
58
+ net_additions: @net_additions
59
+ }
60
+ end
61
+ end
62
+ end
@@ -14,14 +14,14 @@ module Hubstats
14
14
  @users = Hubstats::User.where(id: params[:id].split(",")).order("login ASC")
15
15
  elsif params[:repos]
16
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)
17
+ .with_id(params[:users])
18
+ .custom_order(params[:order])
19
+ .paginate(:page => params[:page], :per_page => 15)
20
20
  else
21
21
  @users = Hubstats::User.only_active.with_all_metrics(@start_date, @end_date)
22
- .with_id(params[:users])
23
- .custom_order(params[:order])
24
- .paginate(:page => params[:page], :per_page => 15)
22
+ .with_id(params[:users])
23
+ .custom_order(params[:order])
24
+ .paginate(:page => params[:page], :per_page => 15)
25
25
  end
26
26
 
27
27
  respond_to do |format|
@@ -49,8 +49,9 @@ module Hubstats
49
49
  stats
50
50
  end
51
51
 
52
- # stats
53
- # Shows the basic stats for both the user show page.
52
+ # Public - Shows the basic stats for the user show page.
53
+ #
54
+ # Returns - the data in a hash
54
55
  def stats
55
56
  @additions ||= 0
56
57
  @deletions ||= 0