Skip to content

Commit

Permalink
Add collab contributions count to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jun 29, 2020
1 parent 5be524c commit c407ee5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/controllers/home_controller.rb
Expand Up @@ -20,6 +20,9 @@ def index
@merged_prs = @issues_scope.where('issues.merged_at > ?', @period.days.ago).not_core.pull_requests.count
@merged_prs_last_week = @issues_scope.where('issues.merged_at > ?', (@period*2).days.ago).where('issues.merged_at < ?', @period.days.ago).not_core.pull_requests.count

@new_collab_contribs = @issues_scope.this_period(@period).all_collabs.count
@new_collab_contribs_last_week = @issues_scope.last_period(@period).all_collabs.count

@releases = @event_scope.this_period(@period).event_type('ReleaseEvent').count

@stars = @event_scope.this_period(@period).not_core.event_type('WatchEvent').count
Expand Down
37 changes: 31 additions & 6 deletions app/views/home/index.html.erb
Expand Up @@ -95,14 +95,19 @@
<div class="card-body">
<div class="media d-flex">
<div class="align-self-center">
<%= octicon 'rocket', height: 50 %>
<%= octicon 'briefcase', height: 50 %>
</div>
<div class="media-body text-right">
<span class='info' title='Releases published by anyone in the past <%= @period %> days'><%= octicon 'info', height: 14 %></span>
<span class='info' title='Pull Requests opened by non-core human contributors in the past <%= @period %> days'><%= octicon 'info', height: 14 %></span>
<h3>
<%= number_to_human @releases %>
<%= number_to_human @new_collab_contribs %>
<% new_collab_contribs_diff = @new_collab_contribs - @new_collab_contribs_last_week %>
<% unless new_collab_contribs_diff.zero? %>
<small class='<%= diff_class(new_collab_contribs_diff) %>' title='<%= @new_collab_contribs_last_week %> pull requests last week'><%= '+' if new_collab_contribs_diff > 0 %><%= number_to_human new_collab_contribs_diff %></small>
<% end %>
</h3>
<span>Releases</span>
<span>Collab Contributions</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -141,7 +146,7 @@
<div class="card-body">
<div class="media d-flex">
<div class="align-self-center">
<%= octicon 'star', height: 50 %>
<%= octicon 'star-fill', height: 50 %>
</div>
<div class="media-body text-right">
<span class='info' title='Stars on internal repositories by non-core humans in the past <%= @period %> days'><%= octicon 'info', height: 14 %></span>
Expand Down Expand Up @@ -239,7 +244,7 @@
<div class="card-body">
<div class="media d-flex">
<div class="align-self-center">
<%= octicon 'person', height: 50 %>
<%= octicon 'people', height: 50 %>
</div>
<div class="media-body text-right">
<span class='info' title='Unique non-core human contributors that opened an issue or pull request in the past <%= @period %> days'><%= octicon 'info', height: 14 %></span>
Expand Down Expand Up @@ -306,5 +311,25 @@
</div>
</div>
</div>
<div class="col-md-3">
<div class="card shadow-sm mb-3">
<div class="card-content">
<div class="card-body">
<div class="media d-flex">
<div class="align-self-center">
<%= octicon 'rocket', height: 50 %>
</div>
<div class="media-body text-right">
<span class='info' title='Releases published by anyone in the past <%= @period %> days'><%= octicon 'info', height: 14 %></span>
<h3>
<%= number_to_human @releases %>
</h3>
<span>Releases</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

0 comments on commit c407ee5

Please sign in to comment.