Merge pull request #3334 from betagouv/improve-satisfaction-graph

Stats : amélioration du graphique de satisfaction
This commit is contained in:
LeSim 2019-02-01 11:08:18 +01:00 committed by GitHub
commit c53d72db1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View file

@ -129,9 +129,9 @@ class StatsController < ApplicationController
def satisfaction_usagers def satisfaction_usagers
legend = { legend = {
Feedback.ratings.fetch(:happy) => "Satisfaits", Feedback.ratings.fetch(:unhappy) => "Mécontents",
Feedback.ratings.fetch(:neutral) => "Neutres", Feedback.ratings.fetch(:neutral) => "Neutres",
Feedback.ratings.fetch(:unhappy) => "Mécontents" Feedback.ratings.fetch(:happy) => "Satisfaits"
} }
number_of_weeks = 6 number_of_weeks = 6
@ -139,7 +139,7 @@ class StatsController < ApplicationController
.group_by_week(:created_at, last: number_of_weeks, current: false) .group_by_week(:created_at, last: number_of_weeks, current: false)
.count .count
Feedback.ratings.values.map do |rating| legend.keys.map do |rating|
data = Feedback data = Feedback
.where(rating: rating) .where(rating: rating)
.group_by_week(:created_at, last: number_of_weeks, current: false) .group_by_week(:created_at, last: number_of_weeks, current: false)

View file

@ -25,8 +25,12 @@
.chart-container .chart-container
.chart .chart
= line_chart @satisfaction_usagers, = area_chart @satisfaction_usagers,
colors: ["#15AD70", "#F28900", "rgba(161, 0, 5, 0.9)"] stacked: true,
suffix: ' %',
max: 100,
library: { plotOptions: { series: { marker: { enabled: true }}}},
colors: ["#C31C25", "#F5962A", "#25B177"]
.stat-card.stat-card-half.pull-left .stat-card.stat-card-half.pull-left
%span.stat-card-title %span.stat-card-title

View file

@ -1,5 +1,7 @@
Chartkick.options = { Chartkick.options = {
content_for: :charts_js, content_for: :charts_js,
defer: true, defer: true,
colors: ["rgba(61, 149, 236, 1)"] colors: ["rgba(61, 149, 236, 1)"],
thousands: ' ',
decimal: ','
} }