From b535f7ce3b348071f0e59bf27a8df18911bba0b4 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 27 Aug 2018 18:18:07 +0200 Subject: [PATCH 1/2] Fix the colors in the satisfaction graph I forgot to change it after I switched to an enum in the previous PR and changed the values order --- app/views/stats/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 666c3033c..27d5e1b75 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -22,7 +22,7 @@ .chart-container .chart = line_chart @satisfaction_usagers, - colors: ["#F28900", "rgba(161, 0, 5, 0.9)", "#15AD70"] + colors: ["#15AD70", "#F28900", "rgba(161, 0, 5, 0.9)"] .stat-card.stat-card-half.pull-left %span.stat-card-title From 4c7f9af73dbc1c9323e66aa27cb359b75624e541 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 27 Aug 2018 18:18:26 +0200 Subject: [PATCH 2/2] Order the legend in the same order as the enum --- app/controllers/stats_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index c24489b83..b9e4adacc 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -89,9 +89,9 @@ class StatsController < ApplicationController def satisfaction_usagers legend = { - Feedback.ratings.fetch(:unhappy) => "Mécontents", + Feedback.ratings.fetch(:happy) => "Satisfaits", 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