Fixed an issue where part id would be different and then not count total missing parts correctly

This commit is contained in:
FrederikBaerentsen 2024-04-26 17:04:10 +02:00
parent 4279403183
commit 053a1891da
2 changed files with 4 additions and 6 deletions

2
app.py
View File

@ -368,7 +368,7 @@ def new_set(set_num):
def missing(): def missing():
conn = sqlite3.connect('app.db') conn = sqlite3.connect('app.db')
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute('SELECT id, part_num, color_id, element_id, part_img_url_id, SUM(quantity) AS total_quantity FROM missing GROUP BY id, part_num, color_id, element_id;') cursor.execute('SELECT part_num, color_id, element_id, part_img_url_id, SUM(quantity) AS total_quantity FROM missing GROUP BY part_num, color_id, element_id;')
results = cursor.fetchall() results = cursor.fetchall()
missing_list = [list(i) for i in results] missing_list = [list(i) for i in results]

View File

@ -101,7 +101,6 @@
<thead> <thead>
<tr> <tr>
<th ></th> <th ></th>
<th >id</th>
<th >part_num</th> <th >part_num</th>
<th >color_id</th> <th >color_id</th>
<th >element_id</th> <th >element_id</th>
@ -112,15 +111,14 @@
{% for brick in missing_list %} {% for brick in missing_list %}
<tr> <tr>
{% if brick[4] == 'nil' %} {% if brick[4] == 'nil' %}
<td><img src="{{ '/static/none.jpg' }}" class="lightbox-trigger" alt="{{ brick[0] }}" style="height: 50px; width: 50px;margin:0;padding: 0;" loading="lazy"></td> <td><img src="{{ '/static/none.jpg' }}" class="lightbox-trigger" alt="{{ brick[3] }}" style="height: 50px; width: 50px;margin:0;padding: 0;" loading="lazy"></td>
{% else %} {% else %}
<td><img src="{{ '/static/parts/' + brick[4] + '.jpg' }}" alt="{{ brick[0] }}" class="lightbox-trigger" style="height: 50px; width: 50px;margin:0;padding: 0;" loading="lazy"></td> <td><img src="{{ '/static/parts/' + brick[3] + '.jpg' }}" alt="{{ brick[3] }}" class="lightbox-trigger" style="height: 50px; width: 50px;margin:0;padding: 0;" loading="lazy"></td>
{% endif %} {% endif %}
<td>{{ brick[0] }}</td> <td>{{ brick[0] }}</td>
<td>{{ brick[1] }}</td> <td>{{ brick[1] }}</td>
<td>{{ brick[2] }}</td> <td>{{ brick[2] }}</td>
<td>{{ brick[3] }}</td> <td>{{ brick[4] }}</td>
<td>{{ brick[5] }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>