Skip to content

Instantly share code, notes, and snippets.

@spullen
Last active December 21, 2015 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spullen/6282871 to your computer and use it in GitHub Desktop.
Save spullen/6282871 to your computer and use it in GitHub Desktop.
<% @categories.each do |category, category_count| %>
<tr class="<%= category %> value" data-count="<%= category_count %>">
<td><%= category_count %></td><td><%= category_count * 100 / @violations_to_check %>%</td><td><%= category_count %></td><td><i class="icon-arrow-up"></i></td>
</tr>
<% end %>
def analytics
@code_review = CodeReview.find(params[:id])
@categories = @code_review.violations.group('category').count
@violations_to_check = @code_review.violations_to_check.size # just to be on the safe side if this does trigger multiple queries in the loop in the view
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment