Show the mean instruction time in the Résumé tab
This commit is contained in:
parent
faff741bf2
commit
d55c9dff4d
5 changed files with 34 additions and 4 deletions
|
@ -326,6 +326,17 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def mean_instruction_time
|
||||
instruction_times = dossiers
|
||||
.state_termine
|
||||
.pluck(:en_instruction_at, :processed_at)
|
||||
.map { |times| times[1] - times[0] }
|
||||
|
||||
if instruction_times.present?
|
||||
instruction_times.sum.fdiv(instruction_times.size).ceil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def can_publish?(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue