diff --git a/sk1/backend/app.py b/sk1/backend/app.py index 6ecd5b2..6a259ce 100644 --- a/sk1/backend/app.py +++ b/sk1/backend/app.py @@ -16,12 +16,12 @@ CORS(app) app.config['CACHE_TYPE'] = 'SimpleCache' cache = Cache(app) -# Database connection + DATABASE_URL = os.environ.get('DATABASE_URL') conn = psycopg2.connect(DATABASE_URL) cursor = conn.cursor() -# Initialize DB + cursor.execute(''' CREATE TABLE IF NOT EXISTS history ( id SERIAL PRIMARY KEY, @@ -47,7 +47,7 @@ def get_current_time(): return datetime.now(tz) def sync_history_file(): - # Synchronizácia history.json so všetkými záznamami z databázy + cursor.execute("SELECT text, prediction, timestamp FROM history ORDER BY timestamp DESC") rows = cursor.fetchall() history = [