From 1a5f1f7ee2625417c75e15870cc05734cf39b7c5 Mon Sep 17 00:00:00 2001 From: rene Date: Mon, 13 Apr 2026 20:25:25 +0200 Subject: [PATCH] Fix: Gewicht-Eintrag schlug fehl (bezeichnung Pflichtfeld + Komma-Dezimal) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - health.py: bezeichnung Optional statt required (Gewicht braucht keinen Titel) - _buildPayload: Komma → Punkt bei wert und kosten (deutsche Lokalisierung) - Gewicht-Einträge setzen automatisch bezeichnung = "9.9 kg" - SW-Cache → by-v10 --- backend/routes/health.py | 2 +- backend/static/js/pages/health.js | 7 +++++-- backend/static/sw.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/routes/health.py b/backend/routes/health.py index c9c9e20..e3eba24 100644 --- a/backend/routes/health.py +++ b/backend/routes/health.py @@ -20,7 +20,7 @@ TYPEN = {"impfung", "entwurmung", "tierarzt", "medikament", "gewicht", "allergie # ------------------------------------------------------------------ class HealthCreate(BaseModel): typ: str - bezeichnung: str + bezeichnung: Optional[str] = None datum: str naechstes: Optional[str] = None notiz: Optional[str] = None diff --git a/backend/static/js/pages/health.js b/backend/static/js/pages/health.js index 2655c15..28d648f 100644 --- a/backend/static/js/pages/health.js +++ b/backend/static/js/pages/health.js @@ -840,8 +840,11 @@ window.Page_health = (() => { schweregrad: fd.schweregrad || null, reaktion: fd.reaktion || null, }; - if (fd.wert) p.wert = parseFloat(fd.wert); - if (fd.kosten) p.kosten = parseFloat(fd.kosten); + if (fd.wert) { + p.wert = parseFloat(fd.wert.replace(',', '.')); + if (typ === 'gewicht') p.bezeichnung = `${p.wert} kg`; + } + if (fd.kosten) p.kosten = parseFloat(fd.kosten.toString().replace(',', '.')); if (fd.tierarzt_id) p.tierarzt_id = parseInt(fd.tierarzt_id); if (typ === 'medikament') { p.aktiv = 'aktiv' in fd ? 1 : 0; diff --git a/backend/static/sw.js b/backend/static/sw.js index 10c217c..9567ecb 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications ============================================================ */ -const CACHE_VERSION = 'by-v9'; +const CACHE_VERSION = 'by-v10'; const CACHE_STATIC = `${CACHE_VERSION}-static`; // Diese Dateien werden beim Install gecacht (App Shell)