diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-02 18:35:20 +0700 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-02 18:35:20 +0700 |
| commit | 696e1a3a79fb1c190b37ae7a2014017ec1171b73 (patch) | |
| tree | 9298fab048fb1efe33d031ae07bf376899c5e926 /backend | |
| parent | e8ab7e82cb56680ba5cdb803be607983af1dc9b2 (diff) | |
finish check
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/main.py | 4 |
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 |
