Merge pull request #6383 from betagouv/improve-repartition-par-semaine
Améliore le graphique "répartition par semaine" dans les statistiques d'une procédure
This commit is contained in:
commit
e1e6c2d5a8
3 changed files with 12 additions and 3 deletions
|
@ -65,7 +65,6 @@ $stat-card-half-horizontal-spacing: 4 * $default-space;
|
|||
|
||||
.stat-card-details {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,12 @@ module ProcedureStatsConcern
|
|||
# rubocop:disable Style/HashTransformValues
|
||||
dossier_state_values
|
||||
.map do |state|
|
||||
{ name: state, data: chart_data.where(state: state).group_by_week { |dossier| dossier.traitements.first.processed_at }.map { |k, v| [k, v.count] }.to_h }
|
||||
{
|
||||
name: state,
|
||||
data: chart_data .where(state: state) .group_by_week do |dossier|
|
||||
dossier.traitements.first.processed_at
|
||||
end.map { |k, v| [k, v.count] }.to_h.transform_keys { |week| pretty_week(week) }
|
||||
}
|
||||
# rubocop:enable Style/HashTransformValues
|
||||
end
|
||||
end
|
||||
|
@ -104,4 +109,8 @@ module ProcedureStatsConcern
|
|||
def pretty_month(month)
|
||||
I18n.l(month, format: "%B %Y")
|
||||
end
|
||||
|
||||
def pretty_week(week)
|
||||
I18n.l(week, format: '%d %b')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
.stat-card.stat-card-half.pull-left
|
||||
%span.stat-card-title RÉPARTITION PAR SEMAINE
|
||||
.stat-card-details au cours des 6 derniers mois
|
||||
.chart-container
|
||||
.chart
|
||||
= line_chart @termines_by_week, colors: ["#387EC3", "#AE2C2B", "#FAD859"]
|
||||
= line_chart @termines_by_week, colors: ["#387EC3", "#AE2C2B", "#FAD859"], ytitle: 'Nb dossiers'
|
||||
|
|
Loading…
Reference in a new issue