instructors : receive daily emails for declarative folders

This commit is contained in:
kara Diaby 2020-03-13 10:24:25 +01:00
parent 50af70ad7c
commit 395af2fbb0
5 changed files with 181 additions and 0 deletions

View file

@ -152,6 +152,8 @@ class Instructeur < ApplicationRecord
h = {
nb_en_construction: groupe.dossiers.en_construction.count,
nb_en_instruction: groupe.dossiers.en_instruction.count,
nb_accepted: groupe.dossiers.accepte.where(processed_at: Time.zone.yesterday.beginning_of_day..Time.zone.yesterday.end_of_day).count,
nb_notification: notifications_for_procedure(procedure, :not_archived).count
}
@ -161,6 +163,14 @@ class Instructeur < ApplicationRecord
acc << h
end
[["en_instruction", h[:nb_en_instruction]], ["accepte", h[:nb_accepted]]].each do |state, count|
if procedure.declarative_with_state == state && count > 0
h[:procedure_id] = procedure.id
h[:procedure_libelle] = procedure.libelle
acc << h
end
end
acc
end
end