From 26d979a12bd69015aaa00ed6d3d47a868fe8f00d Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Fri, 19 Apr 2024 10:43:05 +0200 Subject: [PATCH] Added minifigs page and started a missings page --- app.py | 11 ++- templates/minifigs.html | 176 ++++++++++++++++++++++++++++++++++++++++ templates/missing.html | 69 ++++++++++++++++ 3 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 templates/minifigs.html create mode 100644 templates/missing.html diff --git a/app.py b/app.py index 9e1d302..b4bf980 100644 --- a/app.py +++ b/app.py @@ -312,8 +312,17 @@ def missing(): @app.route('/minifigs',methods=['POST','GET']) def minifigs(): + conn = sqlite3.connect('app.db') + cursor = conn.cursor() + cursor.execute('SELECT fig_num, name, SUM(quantity) AS total_quantity FROM minifigures GROUP BY fig_num, name;') - return 0 + results = cursor.fetchall() + missing_list = [list(i) for i in results] + cursor.close() + conn.close() + + + return render_template('minifigs.html',missing_list=missing_list) @app.route('/create',methods=['POST','GET']) def create(): diff --git a/templates/minifigs.html b/templates/minifigs.html new file mode 100644 index 0000000..8852437 --- /dev/null +++ b/templates/minifigs.html @@ -0,0 +1,176 @@ + + + + + + Set Overview + + + + + + + + +
+
+ + + + + + + + + + + {% for brick in missing_list %} + + + + + + + {% endfor %} + +
fig_numNametotal_quantity
{{ brick[1] }} + {{ brick[0] }}{{ brick[1] }}{{ brick[2] }}
+
+
+ + + + + + diff --git a/templates/missing.html b/templates/missing.html new file mode 100644 index 0000000..c53f89a --- /dev/null +++ b/templates/missing.html @@ -0,0 +1,69 @@ + + + + + + Set Overview + + + + + + +
+
+ + + + + + + + + + + + {% for brick in missing_list %} + + + + + + + + {% endfor %} + +
idpart_numcolor_idelement_idtotal_quantity
{{ brick[0] }}{{ brick[1] }}{{ brick[2] }}{{ brick[3] }}{{ brick[4] }}
+
+
+ + +