Skip to content

Commit

Permalink
Calculate penalty expiration based on event date instead of current date
Browse files Browse the repository at this point in the history
  • Loading branch information
falbru committed Mar 10, 2024
1 parent c48fb05 commit ce47a83
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lego/apps/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,16 @@ class Penalty(BasisModel):
objects = UserPenaltyManager() # type: ignore

def expires(self):
dt = Penalty.penalty_offset(self.created_at) - (
timezone.now() - self.created_at
dt = Penalty.penalty_offset(self.source_event.end_time) - (
timezone.now() - self.source_event.end_time
)
return dt.days

@property
def exact_expiration(self):
"""Returns the exact time of expiration"""
dt = Penalty.penalty_offset(self.created_at) - (
timezone.now() - self.created_at
dt = Penalty.penalty_offset(self.source_event.end_time) - (
timezone.now() - self.source_event.end_time
)
return timezone.now() + dt

Expand Down

0 comments on commit ce47a83

Please sign in to comment.