[#1946] Check if a dossier’s retention period has expired

This commit is contained in:
Frederic Merizen 2018-08-31 15:44:07 +02:00
parent b672377f5b
commit 43d8db88d9
2 changed files with 36 additions and 0 deletions

View file

@ -183,6 +183,16 @@ class Dossier < ApplicationRecord
brouillon? || en_construction?
end
def retention_end_date
if instruction_commencee?
en_instruction_at + procedure.duree_conservation_dossiers_dans_ds.months
end
end
def retention_expired?
instruction_commencee? && retention_end_date <= DateTime.now
end
def text_summary
if brouillon?
parts = [