diff options
Diffstat (limited to 'backend/main.py')
| -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 |
