Skip to content

Commit

Permalink
Test correction
Browse files Browse the repository at this point in the history
  • Loading branch information
alemangui committed Aug 12, 2024
1 parent 3c7ec91 commit ed7673e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions data/models/declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _:
Expand Down

0 comments on commit ed7673e

Please sign in to comment.