hubstats 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzM0YzBhYjY0OTVkNWYwZGU4ODUxODMxOTUwN2ZlMzcwZGE3YzdlYw==
4
+ MTIyNWM2ZWIwNWFmNjg5YWRmOWQ4ZjgyOGY4M2Q1ZmQ0ZjAzNjRhYg==
5
5
  data.tar.gz: !binary |-
6
- ZGRiMDcxNWY1NjQ0ODM3MDBjMjA1YTg1NWM0MjcyZjcxMzIxMjE5Yg==
6
+ ZmJlZTIwMTgzYTk0NGJlMTg5YzBjZmFhMTFmOGUyNTI2MmEyOWY0YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjFmNTMzZGExYTlmYzI5NzliYzc5YmY3YmUwOGU5OTUzYjg5OWRhZjdmZDdl
10
- MzVhZjliMzJjNzc2NmQzNTc3YTIyZTFkNmQ5NjAxNjI4NDZhMTQ5MTczNzFh
11
- NjhjNGVkOWY2N2NhYjVhZDhhNzcyMjJmMTA5NzRkNWUyYTZlZjc=
9
+ NjY4NTdlMGJmNmRlMDM3MmJhN2E4NzQ4MTY0YjUwZWFmYTgwNGYzNDE5OGZj
10
+ ODE2NzE5ZDc3MWYyY2IyMjQyOTZmMmI1YmM5YzZiOTM4Nzg3NTE3N2JhZjIz
11
+ YzY5OWFlZmMzNDk2ZjZkOWNmYTg1ZWZjZWE1NWY1ZWYzZGI2OGQ=
12
12
  data.tar.gz: !binary |-
13
- MWQyZWZjYzFmZjVmMDczMTIwZDAwNzk2OWExM2ZjYWRlOWFmZjgzNzlmN2Zh
14
- MjY5ZjMwNDVhNTZhODZmMTg2Nzc0NDNjM2E3NTQ3ZGU4ODY2MjRjMmUyYjcy
15
- OTY0MDE0Zjc1ODM5YTIwMmRkMjViYWEwZjAyNjc1NTZjYTY5OTM=
13
+ MmVjYTBiMmJmZDIxMWVkZTNjNDJiYTdlMjdiOGY5NjMyOWEwYTQ5ZWI5NDdj
14
+ YzFiNGE5OTg5OWM1N2EyYTQwYTYyYzMwOTE3M2I2OGZkMDc3ZWViYzRlYTcx
15
+ YTc5MThlOWIwMGEyMDYyOGRlOThhNTkyMzhiZTk1YzcwZTBkOTM=
data/.codeclimate.yml ADDED
@@ -0,0 +1,7 @@
1
+ languages:
2
+ Ruby: true
3
+ JavaScript: true
4
+ PHP: true
5
+ Python: true
6
+ exclude_paths:
7
+ - "app/assets/javascripts/hubstats/bootstrap.js"
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,16 @@
1
+ #### v0.3.12
2
+ * Solving the server bug
3
+
4
+ > Emma Sax: Andy Fleener, Nick LaMuro: https://github.com/sportngin/hubstats/pull/63
5
+
6
+ * Adding 2 lines to code climate yml
7
+
8
+ > Emma Sax: Brian Bergstrom: https://github.com/sportngin/hubstats/pull/61
9
+
10
+ * Add a codeclimate yml file to ignore bootstrap.js
11
+
12
+ > Emma Sax: : https://github.com/sportngin/hubstats/pull/60
13
+
1
14
  #### v0.3.11
2
15
  * Trying to fix potential bug that makes commissioner run out of memory
3
16
 
@@ -5,6 +5,10 @@ $(document).ready(function() {
5
5
  queryParameters = getUrlVars();
6
6
  setUserDefaults(queryParameters);
7
7
 
8
+ $("#name").on("click", function(){
9
+ toggleOrder(queryParameters,$(this).attr('id'));
10
+ });
11
+
8
12
  $("#deploys").on("click", function(){
9
13
  toggleOrder(queryParameters,$(this).attr('id'));
10
14
  });
@@ -18,10 +18,10 @@ module Hubstats
18
18
  def show
19
19
  @deploy = Hubstats::Deploy.includes(:repo, :pull_requests).find(params[:id])
20
20
  repo = @deploy.repo
21
- @pull_requests = @deploy.pull_requests
22
- pull_request_count = @pull_requests.length
21
+ @pull_requests = @deploy.pull_requests.limit(20)
22
+ @pull_request_count = @pull_requests.length
23
23
  @stats_basics = {
24
- pull_count: pull_request_count,
24
+ pull_count: @pull_request_count,
25
25
  net_additions: @deploy.find_net_additions,
26
26
  comment_count: @deploy.find_comment_count,
27
27
  additions: @deploy.total_changes(:additions),
@@ -6,12 +6,8 @@ module Hubstats
6
6
  def index
7
7
  URI.decode(params[:label]) if params[:label]
8
8
 
9
- pull_ids = Hubstats::PullRequest
10
- .belonging_to_users(params[:users])
11
- .belonging_to_repos(params[:repos])
12
- .map(&:id)
13
-
14
- @labels = Hubstats::Label.with_a_pull_request(pull_ids).order("pull_request_count DESC")
9
+ pull_requests = PullRequest.all_filtered(params, @timespan)
10
+ @labels = Hubstats::Label.count_by_pull_requests(pull_requests).order("pull_request_count DESC")
15
11
 
16
12
  @pull_requests = Hubstats::PullRequest.includes(:user, :repo)
17
13
  .belonging_to_users(params[:users]).belonging_to_repos(params[:repos])
@@ -25,10 +25,10 @@ module Hubstats
25
25
  @deploy_count = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_since(@timespan).count(:all)
26
26
  @comment_count = Hubstats::Comment.belonging_to_repo(@repo.id).created_since(@timespan).count(:all)
27
27
  @user_count = Hubstats::User.with_pulls_or_comments(@timespan,@repo.id).only_active.length
28
- @net_additions = Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_since(@timespan).sum(:additions).to_i -
29
- Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_since(@timespan).sum(:deletions).to_i
30
- @additions = Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_since(@timespan).average(:additions)
31
- @deletions = Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_since(@timespan).average(:deletions)
28
+ @net_additions = Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).sum(:additions).to_i -
29
+ Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).sum(:deletions).to_i
30
+ @additions = Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).average(:additions)
31
+ @deletions = Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).average(:deletions)
32
32
 
33
33
  stats
34
34
  end
@@ -1,13 +1,14 @@
1
1
  module Hubstats
2
2
  class Label < ActiveRecord::Base
3
- scope :with_a_pull_request, lambda { |pull_ids|
4
- select("hubstats_labels.*")
5
- .select("COUNT(hubstats_labels_pull_requests.pull_request_id) AS pull_request_count")
6
- .joins("LEFT JOIN hubstats_labels_pull_requests ON hubstats_labels_pull_requests.label_id = hubstats_labels.id")
7
- .with_ids(pull_ids)
8
- .having("pull_request_count > 0")
9
- .group("hubstats_labels.id")
10
- }
3
+
4
+ def self.count_by_pull_requests(pull_requests)
5
+ select("hubstats_labels.*")
6
+ .select("COUNT(hubstats_labels_pull_requests.pull_request_id) AS pull_request_count")
7
+ .joins(:pull_requests).merge(pull_requests)
8
+ .having("pull_request_count > 0")
9
+ .group("hubstats_labels.id")
10
+ .order("pull_request_count DESC")
11
+ end
11
12
 
12
13
  scope :with_ids, lambda { |pull_ids| (where("hubstats_labels_pull_requests.pull_request_id" => pull_ids)) }
13
14
 
@@ -60,6 +60,16 @@ module Hubstats
60
60
  self.labels = labels
61
61
  end
62
62
 
63
+ def self.all_filtered(params, timespan)
64
+ filter_based_on_timespan(timespan, params[:state])
65
+ .belonging_to_users(params[:users])
66
+ .belonging_to_repos(params[:repos])
67
+ end
68
+
69
+ def self.filter_based_on_timespan(timespan, state)
70
+ with_state(state).updated_since(timespan)
71
+ end
72
+
63
73
  def self.state_based_order(timespan,state,order)
64
74
  order = ["ASC","DESC"].detect{|order_type| order_type.to_s == order.to_s.upcase } || "DESC"
65
75
  if state == "closed"
@@ -83,6 +83,8 @@ module Hubstats
83
83
  order("average_additions #{order}")
84
84
  when 'deletions'
85
85
  order("average_deletions #{order}")
86
+ when 'name'
87
+ order("name #{order}")
86
88
  else
87
89
  order("pull_request_count #{order}")
88
90
  end
@@ -123,6 +123,8 @@ module Hubstats
123
123
  order("comment_count #{order}")
124
124
  when 'netadditions'
125
125
  order("additions - deletions #{order}")
126
+ when 'name'
127
+ order("login #{order}")
126
128
  else
127
129
  order("pull_request_count #{order}")
128
130
  end
@@ -18,6 +18,9 @@
18
18
  <div class="row">
19
19
  <h4> Pull Requests </h4>
20
20
  <%= render 'hubstats/tables/pulls-condensed' %>
21
+ <% if @pull_request_count > 20 %>
22
+ <p class="pull-right"><%= link_to "View All", pulls_path(:deploys => @deploy.id) %></p>
23
+ <% end %>
21
24
  </div>
22
25
  </div>
23
26
 
@@ -17,3 +17,7 @@
17
17
  </div>
18
18
  </div>
19
19
  </div>
20
+
21
+ <div class="text-center">
22
+ <%= will_paginate @repo, renderer: BootstrapPagination::Rails %>
23
+ </div>
@@ -2,6 +2,7 @@
2
2
  <div class="repos">
3
3
  <div class="row single-repo header">
4
4
  <div class="col-lg-2 col-md-2 col-sm-2">
5
+ <a class="header desc" id="name"> Repository Name <span class="octicon"></span> </a>
5
6
  </div>
6
7
  <div class="col-lg-2 col-md-2 col-sm-2">
7
8
  <a class="header desc" id="deploys"> Deploys <span class="octicon"></span> </a>
@@ -2,6 +2,7 @@
2
2
  <div class="users">
3
3
  <div class="row single-user header">
4
4
  <div class="col-lg-4 col-md-4 col-sm-4">
5
+ <a class="header desc" id="name"> GitHub Username <span class="octicon"></span> </a>
5
6
  </div>
6
7
  <div class="col-lg-2 col-md-2 col-sm-2">
7
8
  <a class="header desc" id="deploys"> Deploys <span class="octicon"></span> </a>
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
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.3.11
4
+ version: 0.3.12
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: 2015-06-15 00:00:00.000000000 Z
12
+ date: 2015-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -131,6 +131,7 @@ executables: []
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
+ - .codeclimate.yml
134
135
  - .gitignore
135
136
  - .octopolo.yml
136
137
  - .rspec