some improvements

This commit is contained in:
derlole
2025-05-09 18:36:01 +00:00
parent 83e6ff3958
commit 41b276c734
16 changed files with 283 additions and 42 deletions

View File

@@ -3,6 +3,7 @@ import os
from datetime import datetime, timedelta
DB_PATH = os.path.join(os.path.dirname(__file__), '../db/commands.db')
DB_PATH_COFFEE = os.path.join(os.path.dirname(__file__), '../db/coffee.db')
### THIS CODE IS NOT PROOFED BUT LOOKS RIGHT###
def update_command_status(command_id, status):
@@ -19,4 +20,24 @@ def update_command_status(command_id, status):
conn.close()
print(f"[DB] Befehl {command_id} auf {status} aktualisiert.")
return status
### THIS CODE IS NOT PROOFED BUT LOOKS RIGHT###
### THIS CODE IS NOT PROOFED BUT LOOKS RIGHT###
def get_coffee_count():
conn = sqlite3.connect(DB_PATH_COFFEE)
cursor = conn.cursor()
cursor.execute("SELECT COUNT(*) FROM coffee")
count = cursor.fetchone()[0]
conn.close()
return count
def get_coffees():
conn = sqlite3.connect(DB_PATH_COFFEE)
cursor = conn.cursor()
cursor.execute("SELECT * FROM coffee")
coffees = cursor.fetchall()
conn.close()
return coffees