From 1ea8127aafc35a4cee20ea9917533bab7d9113f4 Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 14 May 2026 14:02:17 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20needs=5Fdog=5Fselection=20TEXT=20'0'=20w?= =?UTF-8?q?ar=20truthy=20=E2=80=94=20INTEGER=20+=20=3D=3D=3D=201=20Check?= =?UTF-8?q?=20(SW=20by-v946)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/database.py | 16 +++++++++++----- backend/main.py | 2 +- backend/static/js/app.js | 6 +++--- backend/static/sw.js | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/backend/database.py b/backend/database.py index be7d455..f5aee7b 100644 --- a/backend/database.py +++ b/backend/database.py @@ -2153,16 +2153,22 @@ def _migrate(conn_factory): pass # ---- Feature: Subscription-Laufzeit & Kündigung ---- - for col, default in [ - ("subscription_expires_at", "NULL"), - ("subscription_cancelled_at","NULL"), - ("needs_dog_selection", "0"), + for col, typedef in [ + ("subscription_expires_at", "TEXT DEFAULT NULL"), + ("subscription_cancelled_at", "TEXT DEFAULT NULL"), + ("needs_dog_selection", "INTEGER DEFAULT 0"), ]: try: - conn.execute(f"ALTER TABLE users ADD COLUMN {col} TEXT DEFAULT {default}") + conn.execute(f"ALTER TABLE users ADD COLUMN {col} {typedef}") logger.info(f"Migration: {col} hinzugefügt.") except Exception: pass + # Bestehende TEXT-Werte für needs_dog_selection auf 0/1 normalisieren + try: + conn.execute("UPDATE users SET needs_dog_selection=0 WHERE needs_dog_selection='0' OR needs_dog_selection IS NULL") + conn.execute("UPDATE users SET needs_dog_selection=1 WHERE needs_dog_selection='1'") + except Exception: + pass # exercise_progress + training_plan_progress: dog_id ergänzen existing_ep = [r[1] for r in conn.execute("PRAGMA table_info(exercise_progress)").fetchall()] diff --git a/backend/main.py b/backend/main.py index f91ca10..6c17b53 100644 --- a/backend/main.py +++ b/backend/main.py @@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "945" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "946" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/js/app.js b/backend/static/js/app.js index f0a0d78..20c119a 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '945'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '946'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen @@ -567,8 +567,8 @@ const App = (() => { navigate('onboarding'); } - // Abo abgelaufen mit mehreren Hunden → Haupthund auswählen - if (state.user.needs_dog_selection && state.dogs.length > 1) { + // Abo abgelaufen mit mehreren Hunden → Haupthund auswählen (nur wenn explizit 1, nicht "0" string) + if (state.user.needs_dog_selection === 1 && state.dogs.length > 1) { _showDogSelectionModal(); } diff --git a/backend/static/sw.js b/backend/static/sw.js index b0c6ac2..c90276e 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v945'; +const CACHE_VERSION = 'by-v946'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache