mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-02-23 15:49:50 +01:00
add user_tasks, use questionary instead of inquirer, refactor main.py
This commit is contained in:
@@ -63,7 +63,8 @@ def create_tables():
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (app_id)
|
||||
REFERENCES apps (app_id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
UNIQUE (app_id, step)
|
||||
)
|
||||
""")
|
||||
|
||||
@@ -113,9 +114,14 @@ def save_progress(app_id, step, data):
|
||||
if isinstance(data, dict):
|
||||
data = json.dumps(data)
|
||||
|
||||
# INSERT the data, but on conflict (if the app_id and step combination already exists) UPDATE the data
|
||||
insert = sql.SQL(
|
||||
"INSERT INTO progress_steps (app_id, step, data, completed) VALUES (%s, %s, %s, false)"
|
||||
"""INSERT INTO progress_steps (app_id, step, data, completed)
|
||||
VALUES (%s, %s, %s, false)
|
||||
ON CONFLICT (app_id, step) DO UPDATE
|
||||
SET data = excluded.data, completed = excluded.completed"""
|
||||
)
|
||||
|
||||
cursor.execute(insert, (app_id, step, data))
|
||||
|
||||
conn.commit()
|
||||
@@ -123,6 +129,7 @@ def save_progress(app_id, step, data):
|
||||
conn.close()
|
||||
|
||||
|
||||
|
||||
def get_apps_by_id(app_id):
|
||||
conn = create_connection()
|
||||
cursor = conn.cursor()
|
||||
|
||||
Reference in New Issue
Block a user