fix: FDDB-Zeilen im CSV-Import speichern und in Ernährung zeigen
Deploy Development / deploy (push) Successful in 1m12s
Build Test / pytest-backend (push) Successful in 5s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 23s

Bezeichnung/Menge auch ohne Vorlagen-Mapping, Zuordnen-Hinweis, Tagesliste mit Lebensmitteln.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-09-12 15:11:37 +02:00
1 parent a07a668de2
commit 4b1be3019d
7 files changed
+141 -5

No files matched your search

+2
View File
@@ -712,6 +712,8 @@ async def csv_import_execute(
"updated": result["rows_updated"],
"skipped": result["rows_skipped"],
"errors": result["rows_errors"],
"items_written": result.get("items_written", 0),
"unmapped_names": result.get("unmapped_names", 0),
},
"error_details": result["error_details"],
}
+17 -1
View File
@@ -227,7 +227,23 @@ def list_nutrition(limit: int=365, x_profile_id: Optional[str]=Header(default=No
""",
(pid, limit),
)
return [r2d(r) for r in cur.fetchall()]
rows = [r2d(r) for r in cur.fetchall()]
dates = [r["date"] for r in rows if r.get("date") is not None]
counts = {}
if dates:
cur.execute(
"""
SELECT date, COUNT(*) AS item_count
FROM nutrition_items
WHERE profile_id = %s AND date = ANY(%s)
GROUP BY date
""",
(pid, dates),
)
counts = {str(r["date"]): int(r["item_count"] or 0) for r in cur.fetchall()}
for r in rows:
r["item_count"] = counts.get(str(r.get("date")), 0)
return rows
@router.get("/by-date/{date}")