From 93ba6babbdc65ffaf561a93a73649c67cbbca21a Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Sat, 29 Jun 2024 16:33:00 +0200 Subject: [PATCH] Working on #12 --- app.py | 9 ++++++++- templates/missing.html | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 28507b2..a2dcead 100644 --- a/app.py +++ b/app.py @@ -431,6 +431,14 @@ def missing(): cursor.close() conn.close() + color_file = np.loadtxt("colors.csv",delimiter=",",dtype="str") + + color_dict = {str(code): name for code, name, _, _ in color_file} + + for item in missing_list: + color_code = str(item[1]) + if color_code in color_dict: + item[1] = color_dict[color_code] return render_template('missing.html',missing_list=missing_list) @@ -445,7 +453,6 @@ def parts(): cursor.close() conn.close() - return render_template('parts.html',missing_list=missing_list) @app.route('/minifigs',methods=['POST','GET']) diff --git a/templates/missing.html b/templates/missing.html index 9aeabe0..9b8bf0d 100644 --- a/templates/missing.html +++ b/templates/missing.html @@ -102,7 +102,7 @@ part_num - color_id + color element_id total_quantity @@ -118,7 +118,7 @@ {{ brick[0] }} {{ brick[1] }} {{ brick[2] }} - {{ brick[4] }} + {{ brick[3] }} {% endfor %}