From ba72d8bd3532d872b87d3fcec7461862600bdaf0 Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Mon, 19 Feb 2024 00:49:36 +0100 Subject: [PATCH] delete list interactivity + fix create empty list --- src/app.py | 5 +++-- src/db.py | 2 +- web/app.html | 12 +++++++++++- web/app.js | 44 +++++++++++++++++++++++--------------------- web/list.js | 25 +++++++++++++++++++++++++ web/popups.js | 40 ++++++++++++++++++++++++++++++++++++++++ web/style.css | 7 ++++++- 7 files changed, 109 insertions(+), 26 deletions(-) create mode 100644 web/list.js diff --git a/src/app.py b/src/app.py index abbc5da..1af8e26 100644 --- a/src/app.py +++ b/src/app.py @@ -72,8 +72,9 @@ def createList(): items = data.get('items') list_uuid = create_list(name, description) if list_uuid: - for item in items.split('#'): - add_to_list(list_uuid, item) + if len(items)>0 : + for item in items.split('#'): + add_to_list(list_uuid, item) return jsonify({'created list ': name}), 200 else: return jsonify({'create failed': name}), 400 diff --git a/src/db.py b/src/db.py index 688bee5..a126a5a 100644 --- a/src/db.py +++ b/src/db.py @@ -270,7 +270,7 @@ def delete_list(list_uuid): DELETE FROM itemlist WHERE uuid = %s - """, (uuid,)) + """, (list_uuid,)) cursor.close() connection.commit() connection.close() diff --git a/web/app.html b/web/app.html index d532245..a6b5f4e 100644 --- a/web/app.html +++ b/web/app.html @@ -64,6 +64,16 @@ + + +