refactors stats page

This commit is contained in:
rgarcia
2015-09-10 11:03:48 +02:00
parent 9360c0090e
commit a8edad2ab6
2 changed files with 5 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ class StatsController < ApplicationController
skip_authorization_check skip_authorization_check
def show def show
@event_types = Ahoy::Event.select(:name).uniq.pluck(:name) @event_types = Ahoy::Event.group(:name).count
end end
private private

View File

@@ -10,13 +10,13 @@
<div class="small-12 medium-6 column"> <div class="small-12 medium-6 column">
<h3>Combined</h3> <h3>Combined</h3>
<%= events_chart_tag @event_types, id: 'combined' %> <%= events_chart_tag @event_types.keys, id: 'combined' %>
</div> </div>
<div class="small-12"> <div class="small-12">
<% @event_types.each do |event_type| %> <% @event_types.each do |event, count| %>
<h3><%= event_type.titleize %></h3> <h3><%= event.titleize %> (<%= count %>)</h3>
<%= events_chart_tag event_type %> <%= events_chart_tag event %>
<% end %> <% end %>
</div> </div>
</div> </div>