amelioration(procedure.usual_traitement_time_for_recent_dossiers): divise en 3 groupe l'estimation de la duree de traitement
This commit is contained in:
parent
f27ef80553
commit
474fde3380
4 changed files with 211 additions and 24 deletions
|
@ -83,14 +83,18 @@ module ProcedureStatsConcern
|
|||
|
||||
def usual_traitement_time_for_recent_dossiers(nb_days)
|
||||
now = Time.zone.now
|
||||
clusters_count = 3
|
||||
|
||||
traitement_time =
|
||||
traitement_times((now - nb_days.days)..now)
|
||||
.map { |times| times[:processed_at] - times[:depose_at] }
|
||||
.percentile(USUAL_TRAITEMENT_TIME_PERCENTILE)
|
||||
.ceil
|
||||
|
||||
traitement_time = nil if traitement_time == 0
|
||||
traitement_time
|
||||
.sort
|
||||
if traitement_time.size >= clusters_count
|
||||
traitement_time.each_slice((traitement_time.size.to_f / clusters_count.to_f).ceil)
|
||||
.map { _1.percentile(USUAL_TRAITEMENT_TIME_PERCENTILE) }
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
/ FIXME: remove the custom procedure switch at some point
|
||||
- procedure_id_for_which_we_hide_the_estimated_delay = 6547
|
||||
- procedure_path_for_which_we_hide_the_estimated_delay = 'deposer-une-offre-de-stage'
|
||||
- show_time_means = procedure.id != procedure_id_for_which_we_hide_the_estimated_delay && procedure.path != procedure_path_for_which_we_hide_the_estimated_delay
|
||||
|
||||
- cache(procedure.id, expires_in: 1.day) do
|
||||
- if procedure.usual_traitement_time_for_recent_dossiers(ProcedureStatsConcern::NB_DAYS_RECENT_DOSSIERS) && show_time_means
|
||||
- if procedure.usual_traitement_time_for_recent_dossiers(ProcedureStatsConcern::NB_DAYS_RECENT_DOSSIERS)
|
||||
%p
|
||||
Habituellement, les dossiers de cette démarche sont traités dans un délai de #{distance_of_time_in_words(procedure.usual_traitement_time_for_recent_dossiers(ProcedureStatsConcern::NB_DAYS_RECENT_DOSSIERS))}.
|
||||
%p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue