summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-12-02 18:35:20 +0700
committeraltaf-creator <dev@altafcreator.com>2025-12-02 18:35:20 +0700
commit696e1a3a79fb1c190b37ae7a2014017ec1171b73 (patch)
tree9298fab048fb1efe33d031ae07bf376899c5e926
parente8ab7e82cb56680ba5cdb803be607983af1dc9b2 (diff)
finish check
-rw-r--r--backend/main.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/main.py b/backend/main.py
index ece8e1f..d9b7d79 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -381,6 +381,10 @@ def finish_laundry(data: FinishRequestData, response: fastapi.Response, session_
cursor.execute(f"SELECT * FROM timers WHERE timer_id = '{data.id}'")
row = cursor.fetchall()[0]
+ if datetime.datetime.now() < datetime.strptime(row[RowIndices.END_TIME]):
+ response.status_code = fastapi.status.HTTP_400_BAD_REQUEST
+ return "timer has not finished yet"
+
machine_status[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = Status.EMPTY.name
machine_times[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = None
machine_endings[row[RowIndices.BLOCK] - 1][row[RowIndices.MACHINE] - 1] = None