From a71f3f36818c33de66724204c753687a871f9ee6 Mon Sep 17 00:00:00 2001 From: Namonay Date: Fri, 20 Feb 2026 15:07:45 +0000 Subject: [PATCH] add: edit --- server/src/data/app.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/src/data/app.py b/server/src/data/app.py index 992754a..e260bfd 100644 --- a/server/src/data/app.py +++ b/server/src/data/app.py @@ -50,12 +50,9 @@ def submit(): cursor.execute('SELECT 1 FROM items WHERE name = ?', (value,)) item = cursor.fetchone() if item: - conn.close() - return redirect(url_for("mainpage")) - cursor.execute( - "INSERT INTO items (name, time, noshutdown) VALUES (?, ?, ?)", - (value, time_value, noshutdown) - ) + cursor.execute("UPDATE items SET time = ?, noshutdown = ? WHERE name = ?", (time_value, noshutdown, value)) + else: + cursor.execute("INSERT INTO items (name, time, noshutdown) VALUES (?, ?, ?)", (value, time_value, noshutdown)) conn.commit() conn.close() return redirect(url_for("mainpage"))