From ed7673e617d466d8c80f0220972c3b04fcb32e2d Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Mon, 12 Aug 2024 23:19:31 +0200 Subject: [PATCH] Test correction --- data/models/declaration.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/data/models/declaration.py b/data/models/declaration.py index ccdb7af5e..618d3dc5b 100644 --- a/data/models/declaration.py +++ b/data/models/declaration.py @@ -213,11 +213,20 @@ def brevo_parameters(self): @property def expiration_date(self): - expirable_statuses = [Declaration.DeclarationStatus.OBJECTION, Declaration.DeclarationStatus.OBSERVATION] + expirable_statuses = [ + Declaration.DeclarationStatus.OBJECTION, + Declaration.DeclarationStatus.OBSERVATION, + Declaration.DeclarationStatus.ABANDONED, + ] if self.status not in expirable_statuses: return None try: - latest_snapshot = self.snapshots.latest("creation_date") + latest_snapshot = self.snapshots.filter( + status__in=[ + Declaration.DeclarationStatus.OBJECTION, + Declaration.DeclarationStatus.OBSERVATION, + ] + ).latest("creation_date") expiration_date = latest_snapshot.creation_date + timedelta(days=latest_snapshot.expiration_days) return expiration_date except Exception as _: