a
This commit is contained in:
@@ -12,13 +12,10 @@ cursor.execute("""
|
|||||||
CREATE TABLE IF NOT EXISTS items (
|
CREATE TABLE IF NOT EXISTS items (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
time TEXT NOT NULL
|
time TEXT,
|
||||||
|
noshutdown INTEGER DEFAULT 0
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
try:
|
|
||||||
cursor.execute("ALTER TABLE items ADD COLUMN noshutdown INTEGER DEFAULT 0")
|
|
||||||
except sqlite3.OperationalError:
|
|
||||||
pass
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@@ -31,7 +28,7 @@ def get_db_connection():
|
|||||||
def mainpage():
|
def mainpage():
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute("SELECT name, time FROM items ORDER BY name")
|
cursor.execute("SELECT name, time, noshutdown FROM items ORDER BY name")
|
||||||
items = cursor.fetchall()
|
items = cursor.fetchall()
|
||||||
conn.close()
|
conn.close()
|
||||||
print(items)
|
print(items)
|
||||||
@@ -47,7 +44,7 @@ def submit():
|
|||||||
if noshutdown == 0 and not time_value:
|
if noshutdown == 0 and not time_value:
|
||||||
return redirect(url_for("mainpage"))
|
return redirect(url_for("mainpage"))
|
||||||
if noshutdown == 1:
|
if noshutdown == 1:
|
||||||
time_value = 'None'
|
time_value = None
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute('SELECT 1 FROM items WHERE name = ?', (value,))
|
cursor.execute('SELECT 1 FROM items WHERE name = ?', (value,))
|
||||||
|
|||||||
Reference in New Issue
Block a user