stats: i18n pour legende repartition par semaine
This commit is contained in:
parent
56ce4938d8
commit
2ee505e9a9
1 changed files with 10 additions and 1 deletions
|
@ -52,7 +52,12 @@ module ProcedureStatsConcern
|
||||||
# rubocop:disable Style/HashTransformValues
|
# rubocop:disable Style/HashTransformValues
|
||||||
dossier_state_values
|
dossier_state_values
|
||||||
.map do |state|
|
.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
|
# rubocop:enable Style/HashTransformValues
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -104,4 +109,8 @@ module ProcedureStatsConcern
|
||||||
def pretty_month(month)
|
def pretty_month(month)
|
||||||
I18n.l(month, format: "%B %Y")
|
I18n.l(month, format: "%B %Y")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pretty_week(week)
|
||||||
|
I18n.l(week, format: '%d %b')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue