Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when checking whether to notify users #423

Open
djperrefort opened this issue Sep 19, 2024 · 0 comments
Open

Error when checking whether to notify users #423

djperrefort opened this issue Sep 19, 2024 · 0 comments

Comments

@djperrefort
Copy link
Member

The should_notify_upcoming_expiration function is running into a type comparison error when notifying users.

Error notifying user "USER" on upcoming expiration of request 12345: can't compare datetime.datetime to datetime.date
Traceback (most recent call last):
  File "/home/keystone/.local/share/pipx/venvs/keystone-api/lib/python3.11/site-packages/keystone_api/apps/allocations/tasks/notifications.py", line 84, in notify_upcoming_expirations
    if should_notify_upcoming_expiration(user, request):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/keystone/.local/share/pipx/venvs/keystone-api/lib/python3.11/site-packages/keystone_api/apps/allocations/tasks/notifications.py", line 54, in should_notify_upcoming_expiration
    if user.date_joined >= date.today() - timedelta(days=next_threshold):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: can't compare datetime.datetime to datetime.date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant