Order the legend in the same order as the enum

This commit is contained in:
gregoirenovel 2018-08-27 18:18:26 +02:00
parent b535f7ce3b
commit 4c7f9af73d

View file

@ -89,9 +89,9 @@ class StatsController < ApplicationController
def satisfaction_usagers def satisfaction_usagers
legend = { legend = {
Feedback.ratings.fetch(:unhappy) => "Mécontents", Feedback.ratings.fetch(:happy) => "Satisfaits",
Feedback.ratings.fetch(:neutral) => "Neutres", Feedback.ratings.fetch(:neutral) => "Neutres",
Feedback.ratings.fetch(:happy) => "Satisfaits" Feedback.ratings.fetch(:unhappy) => "Mécontents"
} }
totals = Feedback.where(created_at: 5.weeks.ago..Time.now).group_by_week(:created_at).count totals = Feedback.where(created_at: 5.weeks.ago..Time.now).group_by_week(:created_at).count