Merge pull request #3352 from betagouv/dev

2018-02-01-01
This commit is contained in:
LeSim 2019-02-01 15:17:12 +01:00 committed by GitHub
commit 431ea88a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 10 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

@ -14,11 +14,15 @@ module TrustedDeviceConcern
def trusted_device? def trusted_device?
trusted_device_cookie.present? && trusted_device_cookie.present? &&
Time.zone.now - TRUSTED_DEVICE_PERIOD < JSON.parse(trusted_device_cookie)['created_at'] (Time.zone.now - TRUSTED_DEVICE_PERIOD) < trusted_device_cookie_created_at
end end
private private
def trusted_device_cookie_created_at
Time.zone.parse(JSON.parse(trusted_device_cookie)['created_at'])
end
def trusted_device_cookie def trusted_device_cookie
cookies.encrypted[TRUSTED_DEVICE_COOKIE_NAME] cookies.encrypted[TRUSTED_DEVICE_COOKIE_NAME]
end end

View file

@ -1,4 +1,4 @@
- parsed_value = champ.value.present? ? Time.zone.parse(champ.value) : Time.zone.now - parsed_value = champ.value.present? ? Time.zone.parse(champ.value) : nil
.datetime .datetime
= form.datetime_select(:value, selected: parsed_value, start_year: 1950, end_year: 2100, minute_step: 5) = form.datetime_select(:value, selected: parsed_value, start_year: 1950, end_year: 2100, minute_step: 5, include_blank: true)

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: ','
} }