hubstats 0.3.4 → 0.3.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.
Files changed (44) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.markdown +1 -0
  3. data/app/assets/javascripts/hubstats/users.js +5 -1
  4. data/app/controllers/hubstats/deploys_controller.rb +21 -8
  5. data/app/controllers/hubstats/pull_requests_controller.rb +2 -1
  6. data/app/controllers/hubstats/repos_controller.rb +13 -8
  7. data/app/controllers/hubstats/users_controller.rb +4 -5
  8. data/app/models/hubstats/deploy.rb +3 -3
  9. data/app/models/hubstats/pull_request.rb +12 -1
  10. data/app/models/hubstats/repo.rb +1 -0
  11. data/app/models/hubstats/user.rb +11 -1
  12. data/app/views/hubstats/deploys/index.html.erb +4 -4
  13. data/app/views/hubstats/deploys/show.html.erb +4 -0
  14. data/app/views/hubstats/partials/_deploy-condensed.html.erb +9 -4
  15. data/app/views/hubstats/partials/_deploy.html.erb +5 -5
  16. data/app/views/hubstats/partials/_quick_addition_stats.html.erb +19 -0
  17. data/app/views/hubstats/partials/_quick_stats.html.erb +19 -18
  18. data/app/views/hubstats/partials/_repo.html.erb +4 -3
  19. data/app/views/hubstats/partials/_user.html.erb +18 -5
  20. data/app/views/hubstats/pull_requests/show.html.erb +10 -0
  21. data/app/views/hubstats/repos/dashboard.html.erb +6 -11
  22. data/app/views/hubstats/repos/show.html.erb +20 -5
  23. data/app/views/hubstats/tables/_deploys-condensed.html.erb +2 -2
  24. data/app/views/hubstats/tables/_users-condensed.html.erb +1 -1
  25. data/app/views/hubstats/tables/_users.html.erb +9 -2
  26. data/app/views/hubstats/users/index.html.erb +1 -1
  27. data/app/views/hubstats/users/show.html.erb +9 -3
  28. data/config/routes.rb +1 -1
  29. data/db/migrate/20150526154850_create_hubstats_deploys.rb +0 -1
  30. data/db/migrate/20150605184015_add_user_id_delete_deployed_by_to_deploy.rb +6 -0
  31. data/db/migrate/20150605190549_add_merged_by_column_to_pull_request.rb +5 -0
  32. data/db/seeds.rb +1 -1
  33. data/lib/hubstats/version.rb +1 -1
  34. data/spec/controllers/hubstats/deploys_controller_spec.rb +36 -25
  35. data/spec/factories/deploys.rb +8 -1
  36. data/spec/factories/pull_requests.rb +12 -0
  37. data/spec/models/hubstats/comment_spec.rb +2 -2
  38. data/spec/models/hubstats/deploy_spec.rb +20 -20
  39. data/spec/models/hubstats/label_spec.rb +3 -3
  40. data/spec/models/hubstats/pull_request_spec.rb +32 -1
  41. data/spec/models/hubstats/repo_spec.rb +7 -7
  42. data/spec/models/hubstats/user_spec.rb +1 -1
  43. data/test/dummy/db/schema.rb +2 -2
  44. metadata +5 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzViZjVlOWMwMzRlOTM0YjUyNDgxYmEyZjU1ODA1OTJmZGQzNzQxZg==
4
+ NzFmMmMxMmUzZGRlZmQ1OTZlNWU0ZmZkMTIxMmQyNDhlNmEzZjc2Nw==
5
5
  data.tar.gz: !binary |-
6
- NThhMDU0YjJlZWMzOGJhMzM5ZjRjMGRlNTliNTI3MGU4OTcyNDZkOA==
6
+ ZGI0N2Y1YjUyMDlkYmJiM2FiZDY3M2ZlZGFlMDY4M2IzY2ZhNTVlZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWQ2NTJjMzg4YmE5YTg1YmNiZjlmMGU4OTg4MDJkMjM3NDgwNGIyMWNiZDBk
10
- NmM3ZmMxYTk1ZDg0YzI4N2ZhMmRhZGJkODJmMTYzYTU0YjRiNWI0MGEyYzFi
11
- Zjg2YzA2OTFhYjcwN2VmN2ZkMmVmZDE0MDQyMjA5OWYyNTI5MmI=
9
+ ODhkZDEyZWVmZWRmNjUwYTUzMDFkY2IzNjFhNTFmYzAyMTg5NTZkODcwNWJj
10
+ MzRhOTgyZTI4ZDgxNDk5ZDI5MDQ4ZDRmMGJmZWIwNzdlZjAxODlmODYzNjcy
11
+ M2QwY2EyY2FlNmY5MTRkNjZiNDVhMzVlN2JmMTMzYjhiN2EzMGY=
12
12
  data.tar.gz: !binary |-
13
- NjQ3M2FkZWQxNTBmMDIxZjIyY2QzOGNmZGYyMDQ5ZTNkYWM0OGM5YTY3NmY1
14
- NTllNzM0MWViMWY3MTk4ZjVkNjJmZWRlMGY1MTQ0M2NiMjNhMjI4YzY5Mzc2
15
- M2U4ZGE0MzE1MTBmOTQ1YTI4YTc4NDI2YzM1MTc4MDk3Yzk0MDk=
13
+ NmRiMjk0NmMxYjY2MTZiMWEwZjllNjliZDk5YjMxZjRkODdhYzRkNWI1ZTE0
14
+ NzExNjViMzk3OTMyNTZhZDMxMzA2YjVjM2U0MGMyNjQ2NDRkNWU3ZTYwM2Jj
15
+ MjZjMjc2YjFkZWQwNjU1ZGNjZjllYTI0NDExMjBhYWJjMDg5NzI=
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,4 @@
1
+ #### v0.3.5
1
2
  #### v0.3.4
2
3
  #### v0.3.3
3
4
  #### v0.3.3
@@ -5,6 +5,10 @@ $(document).ready(function() {
5
5
  queryParameters = getUrlVars();
6
6
  setUserDefaults(queryParameters);
7
7
 
8
+ $("#deploys").on("click", function(){
9
+ toggleOrder(queryParameters,$(this).attr('id'));
10
+ });
11
+
8
12
  $("#pulls").on("click", function(){
9
13
  toggleOrder(queryParameters,$(this).attr('id'));
10
14
  });
@@ -47,4 +51,4 @@ function setUserDefaults(queryParameters) {
47
51
  else {
48
52
  $("#pulls .octicon").addClass('octicon-arrow-down');
49
53
  }
50
- }
54
+ }
@@ -5,7 +5,7 @@ module Hubstats
5
5
 
6
6
  def index
7
7
  # sets to include user and repo, and sorts data
8
- @deploys = Hubstats::Deploy.includes(:repo).includes(:pull_requests)
8
+ @deploys = Hubstats::Deploy.includes(:repo, :pull_requests, :user).where("user_id IS NOT NULL")
9
9
  .belonging_to_users(params[:users]).belonging_to_repos(params[:repos])
10
10
  .group_by(params[:group])
11
11
  .order_with_timespan(@timespan, params[:order])
@@ -27,7 +27,7 @@ module Hubstats
27
27
  pull_request_count = @pull_requests.length
28
28
  net_additions = find_net_additions(@deploy.id)
29
29
  comment_count = find_comment_count(@deploy.id)
30
- @stats = {
30
+ @stats_basics = {
31
31
  pull_count: pull_request_count,
32
32
  net_additions: net_additions,
33
33
  comment_count: comment_count
@@ -62,27 +62,40 @@ module Hubstats
62
62
 
63
63
  # make a new deploy with all of the correct attributes
64
64
  def create
65
- if params[:deployed_by].nil? || params[:git_revision].nil? || params[:repo_name].nil?
66
- render text: "Missing a necessary parameter: deployer, git revision, or repository name.", :status => 400 and return
65
+ if params[:git_revision].nil? || params[:repo_name].nil? || params[:pull_request_ids].nil?
66
+ render text: "Missing a necessary parameter: git revision, pull request ids, or repository name.", :status => 400 and return
67
67
  else
68
68
  @deploy = Deploy.new
69
69
  @deploy.deployed_at = params[:deployed_at]
70
- @deploy.deployed_by = params[:deployed_by]
71
70
  @deploy.git_revision = params[:git_revision]
72
71
  @repo = Hubstats::Repo.where(full_name: params[:repo_name])
73
72
 
73
+ # Check before assigning the repository
74
74
  if @repo.empty?
75
75
  render text: "Repository name is invalid.", :status => 400 and return
76
76
  else
77
77
  @deploy.repo_id = @repo.first.id.to_i
78
78
  end
79
79
 
80
+ # Check before assigning the pull requests
80
81
  @pull_request_id_array = params[:pull_request_ids].split(",").map {|i| i.strip.to_i}
81
- @deploy.pull_requests = Hubstats::PullRequest.where(repo_id: @deploy.repo_id)
82
- .where(number: @pull_request_id_array)
82
+ if @pull_request_id_array.empty? || @pull_request_id_array == [0]
83
+ render text: "No pull request ids given.", :status => 400 and return
84
+ else
85
+ @deploy.pull_requests = Hubstats::PullRequest.where(repo_id: @deploy.repo_id).where(number: @pull_request_id_array)
86
+ end
87
+
88
+ # Check before assigning the user_id
89
+ if @deploy.pull_requests.first.nil?
90
+ render text: "Pull requests not valid", :status => 400 and return
91
+ else
92
+ if @deploy.pull_requests.first.merged_by
93
+ @deploy.user_id = @deploy.pull_requests.first.merged_by
94
+ end
95
+ end
83
96
 
84
97
  if @deploy.save
85
- render :nothing =>true, :status => 200 and return
98
+ render :nothing => true, :status => 200 and return
86
99
  else
87
100
  render :nothing => true, :status => 400 and return
88
101
  end
@@ -33,7 +33,8 @@ module Hubstats
33
33
  @pull_request = Hubstats::PullRequest.belonging_to_repo(@repo.id).where(id: params[:id]).first
34
34
  @comments = Hubstats::Comment.belonging_to_pull_request(params[:id]).includes(:user).created_since(@timespan).limit(20)
35
35
  @comment_count = Hubstats::Comment.belonging_to_pull_request(params[:id]).includes(:user).created_since(@timespan).count(:all)
36
- @stats = {
36
+ @deploys = Hubstats::Deploy.where(id: @pull_request.deploy_id)
37
+ @stats_basics = {
37
38
  comment_count: @comment_count,
38
39
  net_additions: @pull_request.additions.to_i - @pull_request.deletions.to_i
39
40
  }
@@ -21,14 +21,17 @@ module Hubstats
21
21
  @repo = Hubstats::Repo.where(name: params[:repo]).first
22
22
  @pull_requests = Hubstats::PullRequest.belonging_to_repo(@repo.id).updated_since(@timespan).order("updated_at DESC").limit(20)
23
23
  @users = Hubstats::User.with_pulls_or_comments(@timespan,@repo.id).only_active.limit(20)
24
+ @deploys = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_since(@timespan).limit(20)
24
25
  @pull_count = Hubstats::PullRequest.belonging_to_repo(@repo.id).updated_since(@timespan).count(:all)
25
26
  @deploy_count = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_since(@timespan).count(:all)
26
27
  @user_count = Hubstats::User.with_pulls_or_comments(@timespan,@repo.id).only_active.length
27
- @stats = {
28
+ @stats_basics = {
28
29
  user_count: @user_count,
29
30
  deploy_count: @deploy_count,
30
31
  pull_count: @pull_count,
31
- comment_count: Hubstats::Comment.belonging_to_repo(@repo.id).created_since(@timespan).count(:all),
32
+ comment_count: Hubstats::Comment.belonging_to_repo(@repo.id).created_since(@timespan).count(:all)
33
+ }
34
+ @stats_additions = {
32
35
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).average(:additions).to_i,
33
36
  avg_deletions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).average(:deletions).to_i,
34
37
  net_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_repo(@repo.id).sum(:additions).to_i -
@@ -37,17 +40,19 @@ module Hubstats
37
40
  end
38
41
 
39
42
  def dashboard
40
- @repos = Hubstats::Repo.with_recent_activity(@timespan).limit(20)
41
- @users = Hubstats::User.with_pulls_or_comments(@timespan).only_active.limit(20)
42
- @repo_count = Hubstats::Repo.with_recent_activity(@timespan).count(:all)
43
+ @repos = Hubstats::Repo.with_recent_activity(@timespan)
43
44
  @user_count = Hubstats::User.with_pulls_or_comments(@timespan).only_active.length
44
- @stats = {
45
+ @stats_basics = {
45
46
  user_count: @user_count,
46
47
  deploy_count: Hubstats::Deploy.count(:all),
47
48
  pull_count: Hubstats::PullRequest.merged_since(@timespan).count(:all),
48
- comment_count: Hubstats::Comment.created_since(@timespan).count(:all),
49
+ comment_count: Hubstats::Comment.created_since(@timespan).count(:all)
50
+ }
51
+ @stats_additions = {
49
52
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).average(:additions).to_i,
50
- avg_deletions: Hubstats::PullRequest.merged_since(@timespan).average(:deletions).to_i
53
+ avg_deletions: Hubstats::PullRequest.merged_since(@timespan).average(:deletions).to_i,
54
+ net_additions: Hubstats::PullRequest.merged_since(@timespan).sum(:additions).to_i -
55
+ Hubstats::PullRequest.merged_since(@timespan).sum(:deletions).to_i
51
56
  }
52
57
  end
53
58
  end
@@ -22,15 +22,14 @@ module Hubstats
22
22
  @user = Hubstats::User.where(login: params[:id]).first
23
23
  @pull_requests = Hubstats::PullRequest.belonging_to_user(@user.id).updated_since(@timespan).order("updated_at DESC").limit(20)
24
24
  @comments = Hubstats::Comment.belonging_to_user(@user.id).created_since(@timespan).order("created_at DESC").limit(20)
25
- @review = Hubstats::User.pulls_reviewed_count(@timespan).where(login: params[:id]).first
25
+ @deploys = Hubstats::Deploy.belonging_to_user(@user.id).deployed_since(@timespan).limit(20)
26
26
  @pull_count = Hubstats::PullRequest.belonging_to_user(@user.id).updated_since(@timespan).count(:all)
27
- #@deploy_count = Hubstats::Deploy.belonging_to_user(@user.id).deployed_since(@timespan).count(:all)
27
+ @deploy_count = Hubstats::Deploy.belonging_to_user(@user.id).deployed_since(@timespan).count(:all)
28
28
  @comment_count = Hubstats::Comment.belonging_to_user(@user.id).created_since(@timespan).count(:all)
29
- @stats = {
29
+ @stats_basics = {
30
30
  pull_count: Hubstats::PullRequest.belonging_to_user(@user.id).merged_since(@timespan).count(:all),
31
- #deploy_count: Hubstats::Deploy.belonginging_to_user(@user.id).deployed_since(@timespan).count(:all),
31
+ deploy_count: @deploy_count,
32
32
  comment_count: @comment_count,
33
- review_count: @review ? @review.reviews_count : 0,
34
33
  avg_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_user(@user.id).average(:additions).to_i,
35
34
  avg_deletions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_user(@user.id).average(:deletions).to_i,
36
35
  net_additions: Hubstats::PullRequest.merged_since(@timespan).belonging_to_user(@user.id).sum(:additions).to_i -
@@ -2,7 +2,7 @@ module Hubstats
2
2
  class Deploy < ActiveRecord::Base
3
3
 
4
4
  before_validation :check_time, on: :create
5
- validates :git_revision, :deployed_at, :deployed_by, :repo_id, presence: true
5
+ validates :git_revision, :deployed_at, :repo_id, presence: true
6
6
 
7
7
  def check_time
8
8
  self.deployed_at = Time.now.getutc if deployed_at.nil?
@@ -16,9 +16,9 @@ module Hubstats
16
16
  scope :belonging_to_users, lambda {|user_id| where(user_id: user_id.split(',')) if user_id}
17
17
  scope :order_with_timespan
18
18
  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")
19
- scope :with_user_name, select('DISTINCT hubstats_deploys.deployed_by as user_name, hubstats_deploys.*').joins("LEFT JOIN hubstats_users ON hubstats_users.id = hubstats_deploys.user_id")
19
+ 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")
20
20
 
21
- attr_accessible :git_revision, :repo_id, :deployed_at, :deployed_by, :user_id, :pull_request_ids
21
+ attr_accessible :git_revision, :repo_id, :deployed_at, :user_id, :pull_request_ids
22
22
 
23
23
  belongs_to :user
24
24
  belongs_to :repo
@@ -20,7 +20,7 @@ module Hubstats
20
20
  :review_comments_url, :review_comment_url, :comments_url, :statuses_url, :number,
21
21
  :state, :title, :body, :created_at, :updated_at, :closed_at, :merged_at,
22
22
  :merge_commit_sha, :merged, :mergeable, :comments, :commits, :additions,
23
- :deletions, :changed_files, :user_id, :repo_id
23
+ :deletions, :changed_files, :user_id, :repo_id, :merged_by
24
24
 
25
25
  belongs_to :user
26
26
  belongs_to :repo
@@ -40,6 +40,17 @@ module Hubstats
40
40
  pull_data = github_pull.slice(*column_names.map(&:to_sym))
41
41
 
42
42
  pull = where(:id => pull_data[:id]).first_or_create(pull_data)
43
+
44
+ # Updates the merged_by part of the pull request and the user_id of the deploy
45
+ if github_pull[:merged_by] && github_pull[:merged_by][:id]
46
+ pull_data[:merged_by] = github_pull[:merged_by][:id]
47
+ deploy = Hubstats::Deploy.where(id: pull.deploy_id, user_id: nil).first
48
+ if deploy
49
+ deploy.user_id = pull_data[:merged_by]
50
+ deploy.save!
51
+ end
52
+ end
53
+
43
54
  return pull if pull.update_attributes(pull_data)
44
55
  Rails.logger.warn pull.errors.inspect
45
56
  end
@@ -12,6 +12,7 @@ module Hubstats
12
12
  :pushed_at, :created_at, :updated_at, :owner_id
13
13
 
14
14
  has_many :pull_requests
15
+ has_many :deploys
15
16
  belongs_to :owner, :class_name => "User", :foreign_key => "id"
16
17
 
17
18
  def self.create_or_update(github_repo)
@@ -15,6 +15,12 @@ module Hubstats
15
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'")
16
16
  .group("hubstats_users.id")
17
17
  }
18
+ scope :deploys_count, lambda { |time|
19
+ select("hubstats_users.id as user_id")
20
+ .select("IFNULL(COUNT(DISTINCT hubstats_deploys.id),0) AS deploy_count")
21
+ .joins("LEFT JOIN hubstats_deploys ON hubstats_deploys.user_id = hubstats_users.id AND hubstats_deploys.deployed_at > '#{time}'")
22
+ .group("hubstats_users.id")
23
+ }
18
24
  scope :comments_count, lambda { |time|
19
25
  select("hubstats_users.id as user_id")
20
26
  .select("COUNT(DISTINCT hubstats_comments.id) AS comment_count")
@@ -59,10 +65,11 @@ module Hubstats
59
65
  }
60
66
 
61
67
  scope :with_all_metrics, lambda { |time|
62
- select("hubstats_users.*, pull_request_count, comment_count, average_additions, average_deletions")
68
+ select("hubstats_users.*, deploy_count, pull_request_count, comment_count, average_additions, average_deletions")
63
69
  .joins("LEFT JOIN (#{averages(time).to_sql}) AS averages ON averages.user_id = hubstats_users.id")
64
70
  .joins("LEFT JOIN (#{pull_requests_count(time).to_sql}) AS pull_requests ON pull_requests.user_id = hubstats_users.id")
65
71
  .joins("LEFT JOIN (#{comments_count(time).to_sql}) AS comments ON comments.user_id = hubstats_users.id")
72
+ .joins("LEFT JOIN (#{deploys_count(time).to_sql}) AS deploys ON deploys.user_id = hubstats_users.id")
66
73
  .group("hubstats_users.id")
67
74
  }
68
75
 
@@ -78,6 +85,7 @@ module Hubstats
78
85
  has_many :comments
79
86
  has_many :repos, :class_name => "Repo"
80
87
  has_many :pull_requests
88
+ has_many :deploys
81
89
 
82
90
  def self.create_or_update(github_user)
83
91
  github_user[:role] = github_user.delete :type ##changing :type in to :role
@@ -102,6 +110,8 @@ module Hubstats
102
110
  if order_params
103
111
  order = order_params.include?('asc') ? "ASC" : "DESC"
104
112
  case order_params.split('-').first
113
+ when 'deploys'
114
+ order("deploy_count #{order}")
105
115
  when 'pulls'
106
116
  order("pull_request_count #{order}")
107
117
  when 'comments'
@@ -2,7 +2,7 @@
2
2
  <div class="row" %>
3
3
  <div class="col col-lg-3 col-md-3 col-sm-3">
4
4
 
5
- <!--This div is the two controls on the top left, one is for repos and one is for users-->
5
+ <!-- Allow for filtering by repository or user -->
6
6
  <div class="form-group">
7
7
  <input class="select2-control" id="repos">
8
8
  </input>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
 
16
16
  <div class="col col-lg-9 col-md-9 col-sm-9">
17
- <!--The below div is for the different buttons that control the sorting of what deploys users want to view-->
17
+ <!-- Allow viewing deploys by newest first or oldest first -->
18
18
  <div id="sort-group" class="btn-group" data-toggle="buttons">
19
19
  <label class="btn btn-default" id="desc">
20
20
  <input type="radio" name="sort"> Newest
@@ -24,14 +24,14 @@
24
24
  </label>
25
25
  </div>
26
26
 
27
- <!--The following div is for the group by drop down menu on the top right (but not the timespan one)-->
27
+ <!-- Allow to group by repository and user -->
28
28
  <select id="group-by" class="form-control pull-right" style="width: 100px; display: inline; ">
29
29
  <option value="">Group By</option>
30
30
  <option value="user">User</option>
31
31
  <option value="repo">Repo</option>
32
32
  </select>
33
33
 
34
- <!--Shows all of the deploys-->
34
+ <!-- Show all of the deploys -->
35
35
  <%= render 'hubstats/tables/grouped_deploys' %>
36
36
 
37
37
  <!--Contains the pagination so that only 15 deploys show per page-->
@@ -5,6 +5,10 @@
5
5
  <%= link_to @deploy.repo.name.titleize, repo_path(@deploy.repo.name) %> /
6
6
  <%= @deploy.git_revision.titleize %>
7
7
  </h1>
8
+ <br>
9
+ <h4 class="text-center">
10
+ Deployed at: <%= @deploy.deployed_at %>
11
+ </h4>
8
12
  <!--Show the number of pull requests, comments, and net additions-->
9
13
  <%= render "hubstats/partials/quick_stats" %>
10
14
  </div>
@@ -1,14 +1,19 @@
1
1
  <div class="row single-deploy">
2
+ <div class="user-image-small col-lg-1 col-md-1 col-sm-1 col-xs-2" >
3
+ <img src= <%= deploy.user.avatar_url%> alt= <%= deploy.user.login %> >
4
+ </div>
2
5
 
3
- <div class="deploy-info col-lg-9 col-md-9 col-sm-9 col-xs-8">
6
+ <!-- Show the git revision and when the deploy happened by whom -->
7
+ <div class="deploy-info col-lg-6 col-md-6 col-sm-6 col-xs-5">
4
8
  <h4>
5
- <%= deploy.git_revision %>
9
+ <%= link_to deploy.git_revision, deploy_path(deploy) %>
6
10
  </h4>
7
- by <%= link_to deploy.deployed_by, user_path(deploy.deployed_by) %>
11
+ by <%= link_to deploy.user.login, user_path(deploy.user) %>
8
12
  <%= "#{time_ago_in_words(deploy.deployed_at)} ago "%>
9
13
  </div>
10
14
 
11
- <div class="col-lg-2 col-md-2 col-sm-2">
15
+ <!-- Show all of the pull requests linked to the github PR -->
16
+ <div class="col-lg-5 col-md-5 col-sm-5">
12
17
  <div class="deploy-right">
13
18
  <% deploy.pull_requests.each_with_index do |pull_request, index| %>
14
19
  <% if index == deploy.pull_requests.size - 1 %>
@@ -1,22 +1,22 @@
1
1
  <div class="row single-deploy">
2
2
 
3
3
  <div class="user-image col-lg-1 col-md-1 col-sm-1" >
4
- <!-- <img src= <%= deploy.deployed_by %> alt= <%= deploy.deployed_by%> > -->
4
+ <img src= <%= deploy.user.avatar_url %> alt= <%= deploy.user.login %> >
5
5
  </div>
6
6
 
7
- <!--Show the repo name, git revision, and who deployed it when-->
7
+ <!-- Show the repo name, git revision, and who deployed it when -->
8
8
  <div class="deploy-info col-lg-6 col-md-7 col-sm-6">
9
9
  <h4>
10
10
  <%= link_to deploy.repo.name, repo_path(deploy.repo.name) %> /
11
11
  <%= link_to deploy.git_revision, deploy_path(deploy) %>
12
12
  </h4>
13
- <br> <!--should route to the user/id path-->
14
- by <%= link_to deploy.deployed_by, user_path(deploy.deployed_by) %>
13
+ <br>
14
+ by <%= link_to deploy.user.login, user_path(deploy.user) %>
15
15
  <%= "#{time_ago_in_words(deploy.deployed_at)} ago "%>
16
16
  <br>
17
17
  </div>
18
18
 
19
- <!--Show a list of links with all the pull requests in the deploy-->
19
+ <!-- Show a list of links with all the pull requests in the deploy -->
20
20
  <div class="col-lg-5 col-md-5 col-sm-5">
21
21
  <div class="deploy-right">
22
22
  <% deploy.pull_requests.each_with_index do |pull_request, index| %>
@@ -0,0 +1,19 @@
1
+ <div class="col-lg-<%= (12-(@stats_additions.length)*2)/2 %>"></div>
2
+ <% if @stats_additions.has_key? :net_additions %>
3
+ <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
4
+ <h1> <%= @stats_additions[:net_additions] %> </h1>
5
+ <h4> Net Additions </h4>
6
+ </div>
7
+ <% end %>
8
+ <% if @stats_additions.has_key? :avg_additions %>
9
+ <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
10
+ <h1> <%= @stats_additions[:avg_additions] %> </h1>
11
+ <h4> Average Additions </h4>
12
+ </div>
13
+ <% end %>
14
+ <% if @stats_additions.has_key? :avg_deletions%>
15
+ <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
16
+ <h1><%= @stats_additions[:avg_deletions] %> </h1>
17
+ <h4> Average Deletions </h4>
18
+ </div>
19
+ <% end %>
@@ -1,49 +1,50 @@
1
- <div class="col-lg-<%= (12-(@stats.length)*2)/2 %>"></div>
2
- <% if @stats.has_key? :user_count %>
1
+ <div class="col-lg-<%= (12-(@stats_basics.length)*2)/2 %>"></div>
2
+
3
+ <% if @stats_basics.has_key? :user_count %>
3
4
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
4
- <h1> <%= @stats[:user_count] %> </h1>
5
+ <h1> <%= @stats_basics[:user_count] %> </h1>
5
6
  <h4> Active Users </h4>
6
7
  </div>
7
8
  <% end %>
8
- <% if @stats.has_key? :deploy_count %>
9
+ <% if @stats_basics.has_key? :deploy_count %>
9
10
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
10
- <h1> <%= @stats[:deploy_count] %> </h1>
11
+ <h1> <%= @stats_basics[:deploy_count] %> </h1>
11
12
  <h4> Deploys </h4>
12
13
  </div>
13
14
  <% end %>
14
- <% if @stats.has_key? :pull_count %>
15
+ <% if @stats_basics.has_key? :pull_count %>
15
16
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
16
- <h1> <%= @stats[:pull_count] %> </h1>
17
+ <h1> <%= @stats_basics[:pull_count] %> </h1>
17
18
  <h4> Pull Requests </h4>
18
19
  </div>
19
20
  <% end %>
20
- <% if @stats.has_key? :comment_count %>
21
+ <% if @stats_basics.has_key? :comment_count %>
21
22
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
22
- <h1><%= @stats[:comment_count] %> </h1>
23
+ <h1><%= @stats_basics[:comment_count] %> </h1>
23
24
  <h4> Comments </h4>
24
25
  </div>
25
26
  <% end %>
26
- <% if @stats.has_key? :review_count %>
27
+ <% if @stats_basics.has_key? :review_count %>
27
28
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
28
- <h1> <%= @stats[:review_count] %> </h1>
29
+ <h1> <%= @stats_basics[:review_count] %> </h1>
29
30
  <h4> Code Reviews </h4>
30
31
  </div>
31
32
  <% end %>
32
- <% if @stats.has_key? :net_additions %>
33
+ <% if @stats_basics.has_key? :net_additions %>
33
34
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
34
- <h1> <%= @stats[:net_additions] %> </h1>
35
+ <h1> <%= @stats_basics[:net_additions] %> </h1>
35
36
  <h4> Net Additions </h4>
36
37
  </div>
37
38
  <% end %>
38
- <% if @stats.has_key? :avg_additions %>
39
+ <% if @stats_basics.has_key? :avg_additions %>
39
40
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
40
- <h1> <%= @stats[:avg_additions] %> </h1>
41
+ <h1> <%= @stats_basics[:avg_additions] %> </h1>
41
42
  <h4> Average Additions </h4>
42
43
  </div>
43
44
  <% end %>
44
- <% if @stats.has_key? :avg_deletions%>
45
+ <% if @stats_basics.has_key? :avg_deletions%>
45
46
  <div class="col col-lg-2 col-md-4 col-sm-4 col-xs-4 text-center">
46
- <h1><%= @stats[:avg_deletions] %> </h1>
47
+ <h1><%= @stats_basics[:avg_deletions] %> </h1>
47
48
  <h4> Average Deletions </h4>
48
49
  </div>
49
- <% end %>
50
+ <% end %>