optimise les stats termines by week
This commit is contained in:
parent
fdaca625a1
commit
9bb9462b3a
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ module ProcedureStatsConcern
|
||||||
def stats_termines_by_week
|
def stats_termines_by_week
|
||||||
Rails.cache.fetch("#{cache_key_with_version}/stats_termines_by_week", expires_in: 12.hours) do
|
Rails.cache.fetch("#{cache_key_with_version}/stats_termines_by_week", expires_in: 12.hours) do
|
||||||
now = Time.zone.now
|
now = Time.zone.now
|
||||||
chart_data = dossiers.joins(:traitements)
|
chart_data = dossiers.includes(:traitements)
|
||||||
.state_termine
|
.state_termine
|
||||||
.where(traitements: { processed_at: (now.beginning_of_week - 6.months)..now.end_of_week })
|
.where(traitements: { processed_at: (now.beginning_of_week - 6.months)..now.end_of_week })
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue