Skip to content

Commit

Permalink
Account for watchlist entries with no expiration
Browse files Browse the repository at this point in the history
This should fix the 500 error happening when trying to edit a watchlist entry.
  • Loading branch information
kitsuta committed Jul 26, 2024
1 parent a051c5f commit 59ef2ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion uber/model_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def include_other_details(entry):

@validation.WatchList
def not_active_after_expiration(entry):
if entry.active and localized_now().date() > entry.expiration:
if entry.active and entry.expiration and localized_now().date() > entry.expiration:
return ('expiration', 'An entry cannot be active with an expiration date in the past.')


Expand Down
1 change: 1 addition & 0 deletions uber/tasks/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
def deactivate_expired_watchlist_entries():
with Session() as session:
expired_entries = session.query(WatchList).filter(WatchList.active == True, # noqa: E712
WatchList.expiration != None,
WatchList.expiration <= date.today())

expired_count = expired_entries.count()
Expand Down

0 comments on commit 59ef2ca

Please sign in to comment.