commit
431ea88a5d
5 changed files with 20 additions and 10 deletions
|
@ -129,9 +129,9 @@ class StatsController < ApplicationController
|
|||
|
||||
def satisfaction_usagers
|
||||
legend = {
|
||||
Feedback.ratings.fetch(:happy) => "Satisfaits",
|
||||
Feedback.ratings.fetch(:neutral) => "Neutres",
|
||||
Feedback.ratings.fetch(:unhappy) => "Mécontents"
|
||||
Feedback.ratings.fetch(:unhappy) => "Mécontents",
|
||||
Feedback.ratings.fetch(:neutral) => "Neutres",
|
||||
Feedback.ratings.fetch(:happy) => "Satisfaits"
|
||||
}
|
||||
|
||||
number_of_weeks = 6
|
||||
|
@ -139,7 +139,7 @@ class StatsController < ApplicationController
|
|||
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
||||
.count
|
||||
|
||||
Feedback.ratings.values.map do |rating|
|
||||
legend.keys.map do |rating|
|
||||
data = Feedback
|
||||
.where(rating: rating)
|
||||
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
||||
|
|
|
@ -14,11 +14,15 @@ module TrustedDeviceConcern
|
|||
|
||||
def trusted_device?
|
||||
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
|
||||
|
||||
private
|
||||
|
||||
def trusted_device_cookie_created_at
|
||||
Time.zone.parse(JSON.parse(trusted_device_cookie)['created_at'])
|
||||
end
|
||||
|
||||
def trusted_device_cookie
|
||||
cookies.encrypted[TRUSTED_DEVICE_COOKIE_NAME]
|
||||
end
|
||||
|
|
|
@ -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
|
||||
= 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)
|
||||
|
|
|
@ -25,8 +25,12 @@
|
|||
|
||||
.chart-container
|
||||
.chart
|
||||
= line_chart @satisfaction_usagers,
|
||||
colors: ["#15AD70", "#F28900", "rgba(161, 0, 5, 0.9)"]
|
||||
= area_chart @satisfaction_usagers,
|
||||
stacked: true,
|
||||
suffix: ' %',
|
||||
max: 100,
|
||||
library: { plotOptions: { series: { marker: { enabled: true }}}},
|
||||
colors: ["#C31C25", "#F5962A", "#25B177"]
|
||||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%span.stat-card-title
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
Chartkick.options = {
|
||||
content_for: :charts_js,
|
||||
defer: true,
|
||||
colors: ["rgba(61, 149, 236, 1)"]
|
||||
colors: ["rgba(61, 149, 236, 1)"],
|
||||
thousands: ' ',
|
||||
decimal: ','
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue