diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 6c32af2..14a3929 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 = '482'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '483'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const App = (() => { diff --git a/backend/static/js/pages/zuchthunde.js b/backend/static/js/pages/zuchthunde.js index 78fbb3e..e5d6175 100644 --- a/backend/static/js/pages/zuchthunde.js +++ b/backend/static/js/pages/zuchthunde.js @@ -1292,6 +1292,57 @@ window.Page_zuchthunde = (() => { // KI: Jahresbericht generieren // ---------------------------------------------------------- async function _showJahresbericht() { + // Zuerst prüfen ob bereits ein Bericht existiert + let vorhandeneBerichte = []; + try { vorhandeneBerichte = await API.zuchtKi.jahresberichtList(); } catch {} + + if (vorhandeneBerichte.length) { + const letzter = vorhandeneBerichte[0]; + const letzterTs = new Date(letzter.created_at); + const tageAlt = Math.floor((Date.now() - letzterTs) / 86400000); + const SCHWELLE = 30; // Tage + + if (tageAlt < SCHWELLE) { + const datumStr = letzterTs.toLocaleDateString('de', { + day: '2-digit', month: '2-digit', year: 'numeric' + }); + // Wahlmöglichkeit anbieten + UI.modal.open({ + title: `${UI.icon('chart-bar')} KI-Jahresbericht`, + body: ` +
+ Du hast bereits einen Bericht vom ${datumStr}. +
++ Ein neuer Bericht kostet ein KI-Guthaben. Was möchtest du tun? +
+KI analysiert deine Zuchtkartei…
`, diff --git a/backend/static/sw.js b/backend/static/sw.js index 55c0b13..5458efa 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-v505'; +const CACHE_VERSION = 'by-v506'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten