Removed favicon error and fixed an issue where you could not wrote nothing in a text box and save it
This commit is contained in:
parent
a23205060c
commit
c0111e5c2c
16
app.py
16
app.py
@ -6,7 +6,7 @@ import re
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
#tmp = '71386-10'
|
#tmp = '71386-10'
|
||||||
|
@app.route('/favicon.ico')
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
@ -55,28 +55,22 @@ def save_number(tmp):
|
|||||||
if len(json_file['unit'][int(index)]['bricks']['missing']) == 0:
|
if len(json_file['unit'][int(index)]['bricks']['missing']) == 0:
|
||||||
json_file['unit'][int(index)]['bricks']['missing'].append(json.loads(data))
|
json_file['unit'][int(index)]['bricks']['missing'].append(json.loads(data))
|
||||||
print(json_file)
|
print(json_file)
|
||||||
elif number == '0':
|
elif number == '0' or number == '':
|
||||||
for idx,i in enumerate(json_file['unit'][int(index)]['bricks']['missing']):
|
for idx,i in enumerate(json_file['unit'][int(index)]['bricks']['missing']):
|
||||||
if i['brick']['ID'] == part_num and i['brick']['is_spare'] == is_spare and i['brick']['color_name'] == color:
|
if i['brick']['ID'] == part_num and i['brick']['is_spare'] == is_spare and i['brick']['color_name'] == color:
|
||||||
json_file['unit'][int(index)]['bricks']['missing'].pop(idx)
|
json_file['unit'][int(index)]['bricks']['missing'].pop(idx)
|
||||||
else:
|
else:
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
for idx,i in enumerate(json_file['unit'][int(index)]['bricks']['missing']):
|
for idx,i in enumerate(json_file['unit'][int(index)]['bricks']['missing']):
|
||||||
if not found and i['brick']['ID'] == part_num and i['brick']['is_spare'] == is_spare and i['brick']['color_name'] == color:
|
if not found and i['brick']['ID'] == part_num and i['brick']['is_spare'] == is_spare and i['brick']['color_name'] == color:
|
||||||
print('found one ')
|
|
||||||
print(part_num,i['brick']['ID'])
|
|
||||||
print(is_spare,i['brick']['is_spare'])
|
|
||||||
print(color,i['brick']['color_name'])
|
|
||||||
|
|
||||||
json_file['unit'][int(index)]['bricks']['missing'][idx]['brick']['amount'] = number
|
json_file['unit'][int(index)]['bricks']['missing'][idx]['brick']['amount'] = number
|
||||||
found = True
|
found = True
|
||||||
if not found:
|
if not found:
|
||||||
json_file['unit'][int(index)]['bricks']['missing'].append(json.loads(data))
|
json_file['unit'][int(index)]['bricks']['missing'].append(json.loads(data))
|
||||||
|
|
||||||
if not number == '':
|
|
||||||
with open('./info/'+tmp+'.json', 'w') as dump_file:
|
with open('./info/'+tmp+'.json', 'w') as dump_file:
|
||||||
json.dump(json_file,dump_file)
|
json.dump(json_file,dump_file)
|
||||||
|
|
||||||
return redirect('/{}'.format(tmp))
|
return redirect('/{}'.format(tmp))
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class='inputField'>
|
<div class='inputField'>
|
||||||
<input type="number" style="text-align:center;" id="numberInput" name="numberInput" value="{{ ns.count }}" pattern="\d+" required>
|
<input type="tel" style="text-align:center;" id="numberInput" name="numberInput" value="{{ ns.count }}" pattern="\d+">
|
||||||
<button class="square-button" type="submit">
|
<button class="square-button" type="submit">
|
||||||
<img src="/static/save.svg" alt="Save Icon">
|
<img src="/static/save.svg" alt="Save Icon">
|
||||||
</button>
|
</button>
|
||||||
@ -115,7 +115,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class='inputField'>
|
<div class='inputField'>
|
||||||
<input type="number" style="text-align:center;" id="numberInput" name="numberInput" value="{{ ns.count }}" pattern="\d+" required>
|
<input type="tel" style="text-align:center;" id="numberInput" name="numberInput" value="{{ ns.count }}" pattern="\d+">
|
||||||
<button class="square-button" type="submit">
|
<button class="square-button" type="submit">
|
||||||
<img src="/static/save.svg" alt="Save Icon">
|
<img src="/static/save.svg" alt="Save Icon">
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user