diff --git a/app.py b/app.py index ef2242e..980cae2 100644 --- a/app.py +++ b/app.py @@ -3,10 +3,10 @@ import json from pprint import pprint as pp app = Flask(__name__) -tmp = '71386-10' +#tmp = '71386-10' -@app.route('/') -def index(): +@app.route('/') +def index(tmp): with open('./sets/'+tmp+'/info.json') as info: info_file = json.loads(info.read()) with open('./sets/'+tmp+'/inventory.json') as inventory: @@ -14,12 +14,12 @@ def index(): with open('./info/'+tmp+'.json') as info: json_file = json.loads(info.read()) pp(json_file['unit'][0]['bricks']['missing']) - return render_template('bootstrap_table.html', title=info_file['set_num']+" - "+info_file['name'], + return render_template('bootstrap_table.html', tmp=tmp,title=info_file['set_num']+" - "+info_file['name'], info_file=info_file,inventory_file=inventory_file,json_file=json_file) -@app.route('/saveNumber', methods=['POST']) -def save_number(): +@app.route('//saveNumber', methods=['POST']) +def save_number(tmp): data1 = request.form.get('brick.part.part_num') data2 = request.form.get('brick.color.name') data3 = request.form.get('index') diff --git a/lego.py b/lego.py index 0868bc1..d039b30 100644 --- a/lego.py +++ b/lego.py @@ -54,9 +54,8 @@ if Path("./info/"+set_num + ".json").is_file(): with open("./info/" + set_num + ".json",'w') as f: json.dump(data,f,indent = 4) - else: - with open(set_path+'info.json', 'w', encoding='utf-8') as f: - json.dump(response, f, ensure_ascii=False, indent=4) +with open(set_path+'info.json', 'w', encoding='utf-8') as f: + json.dump(response, f, ensure_ascii=False, indent=4) # save set image to folder set_img_url = response["set_img_url"] diff --git a/templates/bootstrap_table.html b/templates/bootstrap_table.html index c16e0bf..b5512a8 100644 --- a/templates/bootstrap_table.html +++ b/templates/bootstrap_table.html @@ -32,7 +32,7 @@ {% set ns = namespace(count='') %} -
+