hubstats 0.7.7 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69e9dceef5709af0e101322ae573c8d1a4a035ed
4
- data.tar.gz: 961b6cca0f491a47d3d8a475e7e7b8227c45c374
3
+ metadata.gz: c81117f077e962453994f09ec5e806c32fb4b0c3
4
+ data.tar.gz: 9400a593fd42d99fcc32a05a437a53ee5a620937
5
5
  SHA512:
6
- metadata.gz: f729109c909f949efb5f68794f3603877269da76ab8762990c433af36a0d276dd6031f1328685292df1c006bfd5cf4d513d96f147648dd8d2043a2643c25b510
7
- data.tar.gz: d54b403aea3fb86a3de0b4621637f5f938364ae461792d1e23b0439111eb3d12409318ee3a31f0573f7688e6e7ac5b97288c1399b0aa745d1dadacec631c4bd3
6
+ metadata.gz: 1dd16f156ddf9c069529ab49b371abc7c3a328169b72e3d8390f34b01a02b10138ad02a154de9c67e6158f17cd85405bfdd0a9e59ba81c8440f5c14f4ed57145
7
+ data.tar.gz: 9db16e4c561c99cdcb7186750aa2012f0cc29890d9fa161486d55f36683b0656390160aaaedfbfecdcda8385cde74bf820a2bd8bb03cbcc8095dfe6ecf0a66be
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ #### v0.8.0
2
+ * Do not show ignored users on lists, in stats, etc
3
+
4
+ > Emma Sax: Unknown User: https://github.com/sportngin/hubstats/pull/111
5
+
1
6
  #### v0.7.7
2
7
  * Fixing error where updating teams does not grab all of organization's teams
3
8
 
@@ -14,6 +14,7 @@ module Hubstats
14
14
  @users = Hubstats::User.where(id: params[:id].split(",")).order("login ASC")
15
15
  else
16
16
  @users = Hubstats::User.with_all_metrics(@start_date, @end_date)
17
+ .where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"])
17
18
  .with_id(params[:users])
18
19
  .custom_order(params[:order])
19
20
  .paginate(:page => params[:page], :per_page => 15)
@@ -26,14 +26,14 @@ module Hubstats
26
26
  #
27
27
  # Returns - the number of pull requests
28
28
  def get_pull_count
29
- Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).count(:all)
29
+ Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).ignore_pulls_by(Hubstats::User.ignore_users_ids).count(:all)
30
30
  end
31
31
 
32
32
  # Public - Gets the number of comments within the start date and end date
33
33
  #
34
34
  # Returns - the number of comments
35
35
  def get_comment_count
36
- Hubstats::Comment.created_in_date_range(@start_date, @end_date).count(:all)
36
+ Hubstats::Comment.created_in_date_range(@start_date, @end_date).ignore_comments_by(Hubstats::User.ignore_users_ids).count(:all)
37
37
  end
38
38
 
39
39
  # Public - Gets the number of comments per reviewer within the start date and end date
@@ -5,6 +5,7 @@ module Hubstats
5
5
 
6
6
  # Various checks that can be used to filter and find info about comments.
7
7
  scope :created_in_date_range, lambda {|start_date, end_date| where("hubstats_comments.created_at BETWEEN ? AND ?", start_date, end_date)}
8
+ scope :ignore_comments_by, lambda {|user_ids| where("user_id NOT IN (?)", user_ids) if user_ids}
8
9
  scope :belonging_to_pull_request, lambda {|pull_request_id| where(pull_request_id: pull_request_id)}
9
10
  scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
10
11
  scope :belonging_to_team, lambda {|user_ids| where(user_id: user_ids) if user_ids}
@@ -9,6 +9,7 @@ module Hubstats
9
9
  scope :created_in_date_range, lambda {|start_date, end_date| where("hubstats_pull_requests.created_at BETWEEN ? AND ?", start_date, end_date)}
10
10
  scope :merged_in_date_range, lambda {|start_date, end_date| where("hubstats_pull_requests.merged").where("hubstats_pull_requests.merged_at BETWEEN ? AND ?", start_date, end_date)}
11
11
  scope :created_since, lambda {|days| where("hubstats_pull_requests.created_at > ?", Date.today - days)}
12
+ scope :ignore_pulls_by, lambda {|user_ids| where("user_id NOT IN (?)", user_ids) if user_ids}
12
13
  scope :belonging_to_repo, lambda {|repo_id| where(repo_id: repo_id)}
13
14
  scope :belonging_to_team, lambda {|team_id| where(team_id: team_id)}
14
15
  scope :belonging_to_user, lambda {|user_id| where(user_id: user_id)}
@@ -3,10 +3,11 @@ module Hubstats
3
3
 
4
4
  # Various checks that can be used to filter and find info about users.
5
5
  scope :with_id, lambda {|user_id| where(id: user_id.split(',')) if user_id}
6
- scope :only_active, -> { having("comment_count > 0 OR pull_request_count > 0 OR deploy_count > 0") }
7
- scope :is_developer, -> { having("pull_request_count > 0") }
8
- scope :is_reviewer, -> { having("comment_count > 0") }
6
+ scope :only_active, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("comment_count > 0 OR pull_request_count > 0 OR deploy_count > 0") }
7
+ scope :is_developer, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("pull_request_count > 0") }
8
+ scope :is_reviewer, -> { where("login NOT IN (?)", Hubstats.config.github_config["ignore_users_list"]).having("comment_count > 0") }
9
9
  scope :with_contributions, lambda {|start_date, end_date, repo_id| with_all_metrics_repos(start_date, end_date, repo_id) if repo_id}
10
+ scope :ignore_users_ids, -> { where("login IN (?)", Hubstats.config.github_config["ignore_users_list"]).pluck(:id) }
10
11
 
11
12
  # Public - Counts all of the deploys for selected user that occurred between the start_date and end_date.
12
13
  #
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "0.7.7"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -22,6 +22,7 @@ module Hubstats
22
22
  :name => "goosey",
23
23
  :full_name => "sportngin/goosey",
24
24
  :updated_at => Date.today)
25
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
25
26
  get :index
26
27
  expect(assigns(:repos)).to contain_exactly(repo2, repo1, repo3, repo4)
27
28
  end
@@ -43,6 +44,7 @@ module Hubstats
43
44
  :user => user)
44
45
  deploy1 = create(:deploy, :repo_id => 101010)
45
46
  deploy2 = create(:deploy, :repo_id => 101010)
47
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
46
48
  get :show, repo: repo.name
47
49
  expect(assigns(:repo)).to eq(repo)
48
50
  expect(assigns(:repo).pull_requests).to contain_exactly(pull1, pull2)
@@ -71,6 +73,7 @@ module Hubstats
71
73
  :full_name => "sportngin/goosey",
72
74
  :updated_at => Date.today)
73
75
  expect(Hubstats::Repo).to receive_message_chain("with_id.custom_order.paginate").and_return([repo1, repo2, repo3, repo4])
76
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
74
77
  get :index
75
78
  expect(response).to have_http_status(200)
76
79
  end
@@ -11,6 +11,7 @@ module Hubstats
11
11
  user3 = create(:user, :id => 303030, :login => "examplePerson3", :updated_at => Date.today)
12
12
  user4 = create(:user, :id => 404040, :login => "examplePerson4", :updated_at => Date.today)
13
13
  expect(Hubstats::User).to receive_message_chain("with_id.custom_order.paginate").and_return([user2, user3, user1, user4])
14
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
14
15
  get :index
15
16
  expect(response).to have_http_status(200)
16
17
  end
@@ -26,6 +27,7 @@ module Hubstats
26
27
  deploy2 = create(:deploy, :user_id => 101010)
27
28
  comment1 = create(:comment, :user => user, :updated_at => Date.today)
28
29
  comment2 = create(:comment, :user => user, :updated_at => Date.today)
30
+ allow(Hubstats).to receive_message_chain(:config, :github_config, :[]).with("ignore_users_list") { ["user"] }
29
31
  get :show, id: "examplePerson"
30
32
  expect(assigns(:user)).to eq(user)
31
33
  expect(assigns(:user).pull_requests).to contain_exactly(pull1, pull2)
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.7.7
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Hursh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-05 00:00:00.000000000 Z
12
+ date: 2016-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails