summaryrefslogtreecommitdiff
path: root/backend/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/main.py')
-rw-r--r--backend/main.py21
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