sortowanie_w_mass_add #10

Merged
gru merged 90 commits from sortowanie_w_mass_add into master 2025-09-02 17:08:55 +02:00
Showing only changes of commit 8d0106c56d - Show all commits

13
app.py
View File

@@ -2050,22 +2050,21 @@ def all_products():
.filter(~func.lower(func.trim(SuggestedProduct.name)).in_(used_names))
.all()
)
suggested_fallbacks = [
{"name": row.name.strip(), "count": 0} for row in extra_suggestions
]
if sort == "alphabetical":
products += suggested_fallbacks
products.sort(key=lambda x: x["name"].lower())
else:
products += suggested_fallbacks
if not products:
products = suggested_fallbacks
if sort == "alphabetical":
products.sort(key=lambda x: x["name"].lower())
return jsonify(
{"products": products, "total_count": total_count + len(suggested_fallbacks)}
{"products": products, "total_count": (total_count if products else len(products))}
)
@app.route("/upload_receipt/<int:list_id>", methods=["POST"])
@login_required
def upload_receipt(list_id):