From a8edad2ab6c5e7d450ce68d5ae87c3115837092f Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 10 Sep 2015 11:03:48 +0200 Subject: [PATCH] refactors stats page --- app/controllers/stats_controller.rb | 2 +- app/views/stats/show.html.erb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index fe224eb8d..5802ee9e9 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -3,7 +3,7 @@ class StatsController < ApplicationController skip_authorization_check def show - @event_types = Ahoy::Event.select(:name).uniq.pluck(:name) + @event_types = Ahoy::Event.group(:name).count end private diff --git a/app/views/stats/show.html.erb b/app/views/stats/show.html.erb index f5df82b98..da366aa1a 100644 --- a/app/views/stats/show.html.erb +++ b/app/views/stats/show.html.erb @@ -10,13 +10,13 @@

Combined

- <%= events_chart_tag @event_types, id: 'combined' %> + <%= events_chart_tag @event_types.keys, id: 'combined' %>
- <% @event_types.each do |event_type| %> -

<%= event_type.titleize %>

- <%= events_chart_tag event_type %> + <% @event_types.each do |event, count| %> +

<%= event.titleize %> (<%= count %>)

+ <%= events_chart_tag event %> <% end %>