Refactor duty authentication and event type handling
- Introduced a new function `get_authenticated_username` to centralize Mini App authentication logic, improving code readability and maintainability. - Updated the duty fetching logic to map unknown event types to "duty" for consistent API responses. - Enhanced the `get_duties` function to include duties starting on the last day of the specified date range. - Improved session management in the database layer to ensure rollback on exceptions. - Added tests to validate the new authentication flow and event type handling.
This commit is contained in:
@@ -118,7 +118,8 @@ async def _schedule_next_update(
|
||||
for job in job_queue.get_jobs_by_name(name):
|
||||
job.schedule_removal()
|
||||
if when_utc is not None:
|
||||
delay = when_utc - datetime.utcnow()
|
||||
now_utc = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
delay = when_utc - now_utc
|
||||
if delay.total_seconds() < 1:
|
||||
delay = 1
|
||||
job_queue.run_once(
|
||||
|
||||
Reference in New Issue
Block a user