From 36a1e21e3d85fd1faa70a60b1515826a551d2e28 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Thu, 8 Jan 2026 23:30:38 +0800 Subject: fix when reminder timer finished, already changed status to finished although not --- backend/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index 5f460e4..8dc6470 100644 --- a/backend/main.py +++ b/backend/main.py @@ -193,9 +193,6 @@ 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]) @@ -455,6 +452,11 @@ def uri_to_information(data: InformationRequestData, response: fastapi.Response, # --- subscribe @app.post("/notifsubscribe", response_class=PlainTextResponse) def notif_subscribe(data: notif.PushSubscriptionData, response: fastapi.Response): - endpoint = notif.subscribe(data) - response.set_cookie(key="subscription_endpoint", value=endpoint, max_age=COOKIE_MAX_AGE, domain="laundryweb.altafcreator.com", samesite="none", secure=True, path="/") - return "do i need to return something perhaps" + try: + endpoint = notif.subscribe(data) + response.set_cookie(key="subscription_endpoint", value=endpoint, max_age=COOKIE_MAX_AGE, domain="laundryweb.altafcreator.com", samesite="none", secure=True, path="/") + response.status_code = fastapi.status.HTTP_200_OK + return "subscription saved." + except Exception as err: + response.status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR + return f"error, failed to save subscription {err}" -- cgit v1.2.3