Wetter-Pill: Niederschlag = Höchstwert der nächsten 3 Std statt Tages-Max

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).
This commit is contained in:
rene 2026-06-05 20:01:32 +02:00
parent fd6be50762
commit aefdac87ad
8 changed files with 31 additions and 19 deletions

View file

@ -1 +1 @@
1213
1214

View file

@ -86,14 +86,14 @@
<title>Ban Yaro</title>
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
<script src="/js/boot-early.js?v=1213"></script>
<script src="/js/boot-early.js?v=1214"></script>
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
<link rel="stylesheet" href="/css/design-system.css?v=1213">
<link rel="stylesheet" href="/css/layout.css?v=1213">
<link rel="stylesheet" href="/css/components.css?v=1213">
<link rel="stylesheet" href="/css/utilities.css?v=1213">
<link rel="stylesheet" href="/css/lists.css?v=1213">
<link rel="stylesheet" href="/css/design-system.css?v=1214">
<link rel="stylesheet" href="/css/layout.css?v=1214">
<link rel="stylesheet" href="/css/components.css?v=1214">
<link rel="stylesheet" href="/css/utilities.css?v=1214">
<link rel="stylesheet" href="/css/lists.css?v=1214">
</head>
<body>
@ -617,11 +617,11 @@
<div id="modal-container"></div>
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
<script src="/js/api.js?v=1213"></script>
<script src="/js/ui.js?v=1213"></script>
<script src="/js/app.js?v=1213"></script>
<script src="/js/worlds.js?v=1213"></script>
<script src="/js/offline-indicator.js?v=1213"></script>
<script src="/js/api.js?v=1214"></script>
<script src="/js/ui.js?v=1214"></script>
<script src="/js/app.js?v=1214"></script>
<script src="/js/worlds.js?v=1214"></script>
<script src="/js/offline-indicator.js?v=1214"></script>
<!-- Feature-Seiten werden lazy geladen -->
@ -631,7 +631,7 @@
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
<script src="/js/boot.js?v=1213"></script>
<script src="/js/boot.js?v=1214"></script>
</body>

View file

@ -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;

View file

@ -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 = `<svg class="ph-icon" aria-hidden="true" style="width:12px;height:12px;vertical-align:-2px"><use href="/icons/phosphor.svg#${w.icon}"></use></svg>`;
// 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
? ` · <span style="color:#f59e0b;font-weight:700">⚠ ab ${w.rain_warning_time}</span>`

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<script src="/js/landing-init.js?v=1213"></script>
<script src="/js/landing-init.js?v=1214"></script>
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">

View file

@ -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

View file

@ -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):

View file

@ -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