Jun 29 - Implement auto reminder 45 min before user's shift end if not finish checking websites
This commit is contained in:
@@ -1771,8 +1771,11 @@ def get_incomplete_shift_users_near_end(window_minutes: int = 40) -> list:
|
||||
conn.close()
|
||||
|
||||
|
||||
def record_shift_reminder(user_id: int, shift_id: int) -> None:
|
||||
"""Mark that a reminder was sent to this user for this shift today (idempotent)."""
|
||||
def record_shift_reminder(user_id: int, shift_id: int) -> int:
|
||||
"""
|
||||
Atomically claim a reminder slot for this user+shift today via INSERT IGNORE.
|
||||
Returns 1 if the slot was claimed (caller should send), 0 if already claimed.
|
||||
"""
|
||||
conn = None
|
||||
try:
|
||||
conn = get_connection()
|
||||
@@ -1783,7 +1786,9 @@ def record_shift_reminder(user_id: int, shift_id: int) -> None:
|
||||
(user_id, shift_id),
|
||||
)
|
||||
conn.commit()
|
||||
rows = cur.rowcount
|
||||
cur.close()
|
||||
return rows
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user