From 696e1a3a79fb1c190b37ae7a2014017ec1171b73 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Tue, 2 Dec 2025 18:35:20 +0700 Subject: finish check --- backend/main.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend') 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 -- cgit v1.2.3