diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-30 22:24:12 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-30 22:24:12 +0800 |
| commit | 90d97ee89e8cb6d31d986737fe3303d97dabcf94 (patch) | |
| tree | ca6d56712841d584dadbe1d600b195946245380b /backend/main.py | |
| parent | 69b977a1ce9dcbce36b56c7ff3707d9ad1cfb07a (diff) | |
notif and scheduler changes
Diffstat (limited to 'backend/main.py')
| -rw-r--r-- | backend/main.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/backend/main.py b/backend/main.py index 10dd0a1..5f460e4 100644 --- a/backend/main.py +++ b/backend/main.py @@ -193,10 +193,19 @@ def reminder_timer_finished(timer_id): cursor.execute("SELECT * FROM timers WHERE timer_id = ?", (timer_id,)) out = cursor.fetchall() print(out) + + for row in out: + machine_status[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = Status.FINISHED.name - #scheduler.add_job(final_timer_finished, 'date', run_date=out[0][RowIndices.END_TIME], id=str(timer_id), args=[timer_id]) + scheduler.add_job(final_timer_finished, 'date', run_date=out[0][RowIndices.END_TIME], id=str(timer_id), args=[timer_id]) - notif.send_notification(out[0][RowIndices.SUBSCRIPTION_ID]) + notif.send_notification( + out[0][RowIndices.SUBSCRIPTION_ID], + { + "title": "Laundry Reminder", + "body": "Your laundry is almost finished.", + } + ) def final_timer_finished(timer_id): print("timer finished!1", timer_id) @@ -206,7 +215,13 @@ def final_timer_finished(timer_id): for row in out: machine_status[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = Status.FINISHED.name - notif.send_notification(out[0][RowIndices.SUBSCRIPTION_ID]) + notif.send_notification( + out[0][RowIndices.SUBSCRIPTION_ID], + { + "title": "Laundry Finished", + "body": "Do collect your laundry, then press this notification to mark your laundry as collected.", + } + ) # sec min hrs days COOKIE_MAX_AGE = 60 * 60 * 24 * 30 # 30 days |
