Merge pull request #6385 from betagouv/6381-tx-acceptation
Améliore la lisibilité du taux d'acceptation
This commit is contained in:
commit
3bad47b319
2 changed files with 16 additions and 5 deletions
|
@ -31,11 +31,12 @@ module ProcedureStatsConcern
|
||||||
end
|
end
|
||||||
|
|
||||||
def stats_termines_states
|
def stats_termines_states
|
||||||
|
nb_dossiers_termines = dossiers.state_termine.count
|
||||||
Rails.cache.fetch("#{cache_key_with_version}/stats_termines_states", expires_in: 12.hours) do
|
Rails.cache.fetch("#{cache_key_with_version}/stats_termines_states", expires_in: 12.hours) do
|
||||||
[
|
[
|
||||||
['Acceptés', dossiers.where(state: :accepte).count],
|
['Acceptés', percentage(dossiers.where(state: :accepte).count, nb_dossiers_termines)],
|
||||||
['Refusés', dossiers.where(state: :refuse).count],
|
['Refusés', percentage(dossiers.where(state: :refuse).count, nb_dossiers_termines)],
|
||||||
['Classés sans suite', dossiers.where(state: :sans_suite).count]
|
['Classés sans suite', percentage(dossiers.where(state: :sans_suite).count, nb_dossiers_termines)]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -106,6 +107,10 @@ module ProcedureStatsConcern
|
||||||
(seconds / 60.0 / 60.0 / 24.0).ceil
|
(seconds / 60.0 / 60.0 / 24.0).ceil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def percentage(value, total)
|
||||||
|
(100 * value / total.to_f).round(1)
|
||||||
|
end
|
||||||
|
|
||||||
def pretty_month(month)
|
def pretty_month(month)
|
||||||
I18n.l(month, format: "%B %Y")
|
I18n.l(month, format: "%B %Y")
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,10 +30,16 @@
|
||||||
.stat-cards
|
.stat-cards
|
||||||
.stat-card.stat-card-half.pull-left
|
.stat-card.stat-card-half.pull-left
|
||||||
%span.stat-card-title TAUX D’ACCEPTATION
|
%span.stat-card-title TAUX D’ACCEPTATION
|
||||||
|
.stat-card-details depuis le lancement de la procédure
|
||||||
.chart-container
|
.chart-container
|
||||||
.chart
|
.chart
|
||||||
- colors = %w(#C3D9FF #0069CC #1C7EC9) # from _colors.scss
|
= pie_chart @termines_states,
|
||||||
= pie_chart @termines_states, colors: colors
|
code: true,
|
||||||
|
colors: %w(#387EC3 #AE2C2B #FAD859),
|
||||||
|
label: 'Taux',
|
||||||
|
suffix: '%',
|
||||||
|
library: { plotOptions: { pie: { dataLabels: { enabled: true, format: '{point.name} : {point.percentage: .1f}%' } } } }
|
||||||
|
|
||||||
|
|
||||||
.stat-card.stat-card-half.pull-left
|
.stat-card.stat-card-half.pull-left
|
||||||
%span.stat-card-title RÉPARTITION PAR SEMAINE
|
%span.stat-card-title RÉPARTITION PAR SEMAINE
|
||||||
|
|
Loading…
Reference in a new issue