From 19b72a8f5c71088761f5acbd1649542932758cc5 Mon Sep 17 00:00:00 2001 From: Namonay Date: Mon, 2 Mar 2026 09:28:37 +0000 Subject: [PATCH] aa --- server/src/data/app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/src/data/app.py b/server/src/data/app.py index 964cc37..fbd8566 100644 --- a/server/src/data/app.py +++ b/server/src/data/app.py @@ -7,7 +7,7 @@ app = Flask(__name__) pattern = re.compile(r"^(?:[01]\d|2[0-3]):[0-5]\d$") # Regex "XX:XX" DB_PATH = "data.db" - +DEFAULT_TIME = "21:00" conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() @@ -44,7 +44,7 @@ def mainpage(): items = cursor.fetchall() cursor.execute("SELECT default_time FROM val") default_time_row = cursor.fetchone() - default_time = default_time_row[0] if default_time_row else '21:00' + default_time = default_time_row[0] if default_time_row else DEFAULT_TIME conn.close() return render_template('index.html', title='BS Shutdown', items=items, default_time=default_time) @@ -117,9 +117,15 @@ def lookup(): (name,) ) item = cursor.fetchone() + cursor.execute( + "SELECT default_time FROM val", + (name,) + ) + default_time_row = cursor.fetchone() + default_time = default_time_row[0] if default_time_row else DEFAULT_TIME conn.close() if item: return jsonify({"name": item["name"], "noshutdown": item["noshutdown"], "time": item["time"]}), 200 else: - return jsonify({"error": "Not found"}), 404 \ No newline at end of file + return jsonify({"noshutdown": 0, "time": default_time}), 200 \ No newline at end of file