Fix: needs_dog_selection TEXT '0' war truthy — INTEGER + === 1 Check (SW by-v946)

This commit is contained in:
rene 2026-05-14 14:02:17 +02:00
parent 3b666c545f
commit 1ea8127aaf
4 changed files with 16 additions and 10 deletions

View file

@ -2153,16 +2153,22 @@ def _migrate(conn_factory):
pass pass
# ---- Feature: Subscription-Laufzeit & Kündigung ---- # ---- Feature: Subscription-Laufzeit & Kündigung ----
for col, default in [ for col, typedef in [
("subscription_expires_at", "NULL"), ("subscription_expires_at", "TEXT DEFAULT NULL"),
("subscription_cancelled_at","NULL"), ("subscription_cancelled_at", "TEXT DEFAULT NULL"),
("needs_dog_selection", "0"), ("needs_dog_selection", "INTEGER DEFAULT 0"),
]: ]:
try: 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.") logger.info(f"Migration: {col} hinzugefügt.")
except Exception: except Exception:
pass 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 # exercise_progress + training_plan_progress: dog_id ergänzen
existing_ep = [r[1] for r in conn.execute("PRAGMA table_info(exercise_progress)").fetchall()] existing_ep = [r[1] for r in conn.execute("PRAGMA table_info(exercise_progress)").fetchall()]

View file

@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request):
raise _HE(404, "Nicht gefunden.") raise _HE(404, "Nicht gefunden.")
return _media_response(filepath) 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") @app.get("/.well-known/assetlinks.json")
async def assetlinks(): async def assetlinks():

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung. 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 APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt
const IS_STAGING = location.hostname === 'staging.banyaro.app'; const IS_STAGING = location.hostname === 'staging.banyaro.app';
// Cache-Bust-Parameter nach Update-Reload sofort entfernen // Cache-Bust-Parameter nach Update-Reload sofort entfernen
@ -567,8 +567,8 @@ const App = (() => {
navigate('onboarding'); navigate('onboarding');
} }
// Abo abgelaufen mit mehreren Hunden → Haupthund auswählen // Abo abgelaufen mit mehreren Hunden → Haupthund auswählen (nur wenn explizit 1, nicht "0" string)
if (state.user.needs_dog_selection && state.dogs.length > 1) { if (state.user.needs_dog_selection === 1 && state.dogs.length > 1) {
_showDogSelectionModal(); _showDogSelectionModal();
} }

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache Offline-Cache + Push Notifications + Tile-Cache
============================================================ */ ============================================================ */
const CACHE_VERSION = 'by-v945'; const CACHE_VERSION = 'by-v946';
const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache