summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/main.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/main.py b/backend/main.py
index 00cbd8c..028fbfa 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -142,6 +142,7 @@ URI_TO_MACHINES = {
"h2-washer2": [2, 4],
}
+TZ = "+07:00"
# ## global vars for user-end
@@ -295,9 +296,9 @@ def start_new_timer(data: RequestData, response: fastapi.Response, session_key:
end_date = now + datetime.timedelta(minutes=(data.duration * 30))
cursor.execute("""
INSERT INTO timers (user_id, start_time, end_time, block, machine, status, subscription_id)
- VALUES (?, ?, ?, ?, ?, ?, ?)""", (session_key, now.isoformat(), end_date.isoformat(), block, machine, 'RUNNING', subscription_endpoint,))
+ VALUES (?, ?, ?, ?, ?, ?, ?)""", (session_key, now.isoformat() + TZ, end_date.isoformat() + TZ, block, machine, 'RUNNING', subscription_endpoint,))
conn.commit()
- cursor.execute("SELECT * FROM timers WHERE end_time = ?;", (end_date.isoformat(),))
+ cursor.execute("SELECT * FROM timers WHERE end_time = ?;", (end_date.isoformat() + TZ,))
out = cursor.fetchall()
for row in out:
@@ -320,7 +321,7 @@ def start_new_timer(data: RequestData, response: fastapi.Response, session_key:
try:
machine_status[block - 1][machine - 1] = Status.RUNNING.name
- machine_times[block - 1][machine - 1] = now.isoformat()
+ machine_times[block - 1][machine - 1] = now.isoformat() + TZ
machine_endings[block - 1][machine - 1] = end_date
except Exception as exception:
print("err @ machine_status //", exception)