add: edit

This commit is contained in:
2026-02-20 15:07:45 +00:00
parent 9f8a9eebfe
commit a71f3f3681

View File

@@ -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"))