From aefdac87ad4ed700e35fd2ac6bf79f4bababcc7f Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 5 Jun 2026 20:01:32 +0200 Subject: [PATCH] =?UTF-8?q?Wetter-Pill:=20Niederschlag=20=3D=20H=C3=B6chst?= =?UTF-8?q?wert=20der=20n=C3=A4chsten=203=20Std=20statt=20Tages-Max?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit weather.py get_weather_for_location: precip = max(h_precip[now_h:now_h+3]) (Fallback Tages-Max). map.js Pill zeigt '💧 X% (3h)'. Gilt auch fĂŒrs Welten-Banner (geteiltes precip_prob-Feld) — behebt das 'ganzer Tag'-Problem ĂŒberall. Gespeicherte Tagebuch-Snapshots unberĂŒhrt (historisch). --- VERSION | 2 +- backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/js/pages/map.js | 3 ++- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- backend/weather.py | 8 +++++++- docs/OFFLINE_MAPS_PLAN.md | 7 ++++++- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 847dd18..4dedbee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1213 \ No newline at end of file +1214 \ No newline at end of file diff --git a/backend/static/index.html b/backend/static/index.html index 77b269b..8819f3e 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -617,11 +617,11 @@ - - - - - + + + + + @@ -631,7 +631,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 00af0f7..ca60503 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 = '1213'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1214'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfĂŒgbar fĂŒr andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; diff --git a/backend/static/js/pages/map.js b/backend/static/js/pages/map.js index 9517e45..90959b7 100644 --- a/backend/static/js/pages/map.js +++ b/backend/static/js/pages/map.js @@ -2597,8 +2597,9 @@ window.Page_map = (() => { const w = await API.weather.get(lat, lon); const temp = w.temp_c != null ? `${Math.round(w.temp_c)}°` : '–'; const icon = ``; + // precip_prob = Höchstwert der nĂ€chsten 3 Stunden → Fenster im Pill kennzeichnen. const regen = w.precip_prob != null - ? (w.next_rain_time ? ` · 💧 ${w.precip_prob}% ab ${w.next_rain_time}` : ` · 💧 ${w.precip_prob}%`) + ? ` · 💧 ${w.precip_prob}% (3h)${w.next_rain_time ? ` ab ${w.next_rain_time}` : ''}` : ''; const warning = w.rain_warning_time ? ` · ⚠ ab ${w.rain_warning_time}` diff --git a/backend/static/landing.html b/backend/static/landing.html index 5f3d168..42acd35 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App fĂŒr Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index 8a9b471..800b14d 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle fĂŒr die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1213'; +const VER = '1214'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt ĂŒber SW-Updates erhalten diff --git a/backend/weather.py b/backend/weather.py index 4973f09..f9a8ed2 100644 --- a/backend/weather.py +++ b/backend/weather.py @@ -95,7 +95,7 @@ async def get_weather_for_location(lat: float, lon: float) -> dict: wcode = cur.get('weathercode', 0) wind = cur.get('windspeed_10m') is_day = cur.get('is_day', 1) - precip = (daily.get('precipitation_probability_max') or [None])[0] + _daily_precip_max = (daily.get('precipitation_probability_max') or [None])[0] # Fallback uv = (daily.get('uv_index_max') or [None])[0] desc, icon = _WMO.get(wcode, ('Unbekannt', 'cloud')) @@ -115,6 +115,12 @@ async def get_weather_for_location(lat: float, lon: float) -> dict: h_times = hourly.get('time', []) h_precip = hourly.get('precipitation_probability', []) + # Niederschlag fĂŒrs Pill: Höchstwert der NÄCHSTEN 3 STUNDEN (ab aktueller Stunde) statt Tages-Max + # — relevanter fĂŒrs "jetzt/gleich Gassi?". h_precip ist nach Stunde indiziert (0 = heute 00:00); + # der Slice ist am Tagesende automatisch kĂŒrzer (forecast_days=1). + _next3 = [p for p in h_precip[now_h:now_h + 3] if p is not None] + precip = max(_next3) if _next3 else _daily_precip_max + # Index-Liste nur fĂŒr Stunden im Fenster now_h+1 
 now_h+12 window = [] for t, p in zip(h_times, h_precip): diff --git a/docs/OFFLINE_MAPS_PLAN.md b/docs/OFFLINE_MAPS_PLAN.md index 1e6ca0d..73135e3 100644 --- a/docs/OFFLINE_MAPS_PLAN.md +++ b/docs/OFFLINE_MAPS_PLAN.md @@ -128,7 +128,12 @@ Siehe `docs/TILE_SERVER_HANDOVER.md` (Tile-Pipeline) + Memory `project_tile_serv # Weitere Karten-To-Dos (nicht offline-spezifisch) -## Wetter-Chip: Niederschlag „nĂ€chste 3 Std" statt ganzer Tag +## Wetter-Chip: Niederschlag „nĂ€chste 3 Std" statt ganzer Tag — ✅ ERLEDIGT (2026-06-05, v1214) +Umgesetzt: `weather.py get_weather_for_location` → `precip = max(h_precip[now_h:now_h+3])` (Fallback Tages-Max); +Pill `map.js` zeigt `💧 X% (3h)`. Gilt auch fĂŒrs Welten-Banner (geteiltes Feld). Hinweis: forecast_days=1 → +Slice am Tagesende kĂŒrzer (spĂ€te Nacht weniger Vorausschau); fĂŒr volle Mitternachts-Abdeckung forecast_days=2. + +(Original-Notiz:) **Ist:** Der Karten-Chip unten zeigt die Regenwahrscheinlichkeit als **Tages-Maximum** (`backend/weather.py:98` → `precip = daily['precipitation_probability_max'][0]`; angezeigt in `pages/map.js:~2598` als `💧 {w.precip_prob}%`). Über den ganzen Tag gemittelt/maximiert = wenig