Skip to content

Commit

Permalink
[#10951] duree_totale_conservation_in_months depends of the dossier s…
Browse files Browse the repository at this point in the history
…tate
  • Loading branch information
mmagn committed Dec 17, 2024
1 parent f0edb9c commit 7546723
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,12 @@ def close_to_expiration?
expiration_notification_date < Time.zone.now && Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago < expiration_notification_date
end

def duree_totale_conservation_in_months
duree_conservation_dossier = brouillon? ? [procedure.duree_conservation_dossiers_dans_ds, Expired::MONTHS_BEFORE_BROUILLON_EXPIRATION].min : procedure.duree_conservation_dossiers_dans_ds

duree_conservation_dossier + (conservation_extension / 1.month.to_i)
end

def has_expired?
return false if en_instruction?
expiration_notification_date < Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago
Expand Down Expand Up @@ -714,10 +720,6 @@ def text_summary
parts.join
end

def duree_totale_conservation_in_months
procedure.duree_conservation_dossiers_dans_ds + (conservation_extension / 1.month.to_i)
end

def avis_for_expert(expert)
Avis
.where(dossier_id: id, confidentiel: false)
Expand Down
2 changes: 1 addition & 1 deletion config/locales/shared.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fr:
refused_by_svr: "Le service traitant n’a pas été en mesure de traiter votre demande dans le délai imparti par la règle du Silence Vaut Rejet."
header:
expires_at:
brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la création du dossier)"
brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la dernière modification du dossier)"
en_construction: "Expirera le %{date} (%{duree_conservation_totale} mois après le dépôt du dossier)"
en_instruction: "Ce dossier est en instruction, il n’expirera pas"
accepte: "Expirera le %{date} (%{duree_conservation_totale} mois après le traitement du dossier)"
Expand Down
2 changes: 1 addition & 1 deletion spec/system/users/brouillon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
{ mandatory: false, libelle: "nombre décimal", type: :decimal_number },
{ mandatory: false, libelle: 'address', type: :address },
{ mandatory: false, libelle: 'IBAN', type: :iban }
])
], duree_conservation_dossiers_dans_ds: 6)
}

scenario 'save an incomplete dossier as draft but cannot not submit it' do
Expand Down

0 comments on commit 7546723

Please sign in to comment.