v1.3.1: Smart Cache vereinfacht (KW-Check + 1h Alter), Build-Script auto-commit+push
This commit is contained in:
@@ -32,7 +32,7 @@ Das System umfasst die Darstellung von Menüplänen in einer Wochenübersicht, d
|
||||
| FR-021 | Das System muss bereits geladene Menüdaten zwischenspeichern, um bei erneutem Aufruf sofort eine Übersicht anzeigen zu können. | Mittel | v1.0.1 |
|
||||
| FR-022 | Das System muss dem Benutzer die Möglichkeit bieten, die Menüdaten manuell neu zu laden. | Niedrig | v1.0.1 |
|
||||
| FR-023 | Der Zeitpunkt der letzten Aktualisierung muss für den Benutzer sichtbar sein. | Niedrig | v1.0.1 |
|
||||
| FR-024 | Das System darf beim Start keinen automatischen API-Refresh durchführen, wenn der Cache frisch (< 1 Stunde) und vollständig ist (nächste 5 Arbeitstage abgedeckt). | Mittel | v1.3.1 |
|
||||
| FR-024 | Das System darf beim Start keinen automatischen API-Refresh durchführen, wenn der Cache frisch (< 1 Stunde) und Daten für die aktuelle Kalenderwoche vorhanden sind. | Mittel | v1.3.1 |
|
||||
| **Bestellfunktion** | | | |
|
||||
| FR-030 | Authentifizierte Benutzer müssen ein verfügbares Menü direkt aus der Übersicht bestellen können. | Hoch | v1.0.1 |
|
||||
| FR-031 | Authentifizierte Benutzer müssen eine bestehende Bestellung direkt aus der Übersicht stornieren können. | Hoch | v1.0.1 |
|
||||
|
||||
@@ -267,14 +267,21 @@ if [ $TEST_EXIT -ne 0 ]; then
|
||||
fi
|
||||
echo "✅ All build tests passed."
|
||||
|
||||
# === 5. Auto-tag version ===
|
||||
# === 5. Auto-tag and push ===
|
||||
echo ""
|
||||
echo "=== Tagging $VERSION ==="
|
||||
if git rev-parse "$VERSION" >/dev/null 2>&1; then
|
||||
git tag -f "$VERSION"
|
||||
echo "🔄 Tag $VERSION moved to current commit."
|
||||
echo " ⚠️ Force-push required: git push origin --force tag $VERSION"
|
||||
else
|
||||
git tag "$VERSION"
|
||||
echo "✅ Created tag: $VERSION"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Committing & Pushing ==="
|
||||
git add -A
|
||||
git commit -m "dist files for $VERSION built" --allow-empty
|
||||
git push
|
||||
git push origin --force tag "$VERSION"
|
||||
echo "✅ Pushed commit + tag $VERSION"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## v1.3.1 (2026-02-17)
|
||||
- **Feature**: Smart Cache – Initialer API-Refresh wird übersprungen wenn Cache < 1h alt und nächste 5 Arbeitstage abgedeckt. ⚡
|
||||
- **Feature**: Smart Cache – API-Refresh beim Start wird übersprungen wenn Daten für die aktuelle KW vorhanden und Cache < 1h alt ist. ⚡
|
||||
|
||||
## v1.3.0 (2026-02-16)
|
||||
- **Feature**: GitHub Release Management 📦
|
||||
|
||||
2
dist/bookmarklet-payload.js
vendored
2
dist/bookmarklet-payload.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bookmarklet.txt
vendored
2
dist/bookmarklet.txt
vendored
File diff suppressed because one or more lines are too long
2
dist/install.html
vendored
2
dist/install.html
vendored
File diff suppressed because one or more lines are too long
28
dist/kantine-standalone.html
vendored
28
dist/kantine-standalone.html
vendored
@@ -2539,25 +2539,19 @@ body {
|
||||
|
||||
// Condition 1: Cache < 1 hour old
|
||||
const ageMs = Date.now() - new Date(cachedTs).getTime();
|
||||
if (ageMs > 60 * 60 * 1000) return false;
|
||||
|
||||
// Condition 2: Data covers next 5 working days
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const cachedDates = new Set();
|
||||
allWeeks.forEach(w => (w.days || []).forEach(d => cachedDates.add(d.date)));
|
||||
|
||||
let coveredDays = 0;
|
||||
for (let i = 0; i < 7 && coveredDays < 5; i++) {
|
||||
const check = new Date(today);
|
||||
check.setDate(check.getDate() + i);
|
||||
const dow = check.getDay();
|
||||
if (dow === 0 || dow === 6) continue; // Skip weekends
|
||||
const dateStr = check.toISOString().split('T')[0];
|
||||
if (cachedDates.has(dateStr)) coveredDays++;
|
||||
const ageMin = Math.round(ageMs / 60000);
|
||||
if (ageMs > 60 * 60 * 1000) {
|
||||
console.log(`[Cache] Stale: ${ageMin}min old (max 60)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
return coveredDays >= 5;
|
||||
// Condition 2: Data for current week exists
|
||||
const thisWeek = getISOWeek(new Date());
|
||||
const thisYear = getWeekYear(new Date());
|
||||
const hasCurrentWeek = allWeeks.some(w => w.weekNumber === thisWeek && w.year === thisYear && w.days && w.days.length > 0);
|
||||
|
||||
console.log(`[Cache] Age: ${ageMin}min, KW${thisWeek}: ${hasCurrentWeek ? 'vorhanden' : 'fehlt'}`);
|
||||
return hasCurrentWeek;
|
||||
}
|
||||
|
||||
// === Menu Data Fetching (Direct from Bessa API) ===
|
||||
|
||||
28
kantine.js
28
kantine.js
@@ -803,25 +803,19 @@
|
||||
|
||||
// Condition 1: Cache < 1 hour old
|
||||
const ageMs = Date.now() - new Date(cachedTs).getTime();
|
||||
if (ageMs > 60 * 60 * 1000) return false;
|
||||
|
||||
// Condition 2: Data covers next 5 working days
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const cachedDates = new Set();
|
||||
allWeeks.forEach(w => (w.days || []).forEach(d => cachedDates.add(d.date)));
|
||||
|
||||
let coveredDays = 0;
|
||||
for (let i = 0; i < 7 && coveredDays < 5; i++) {
|
||||
const check = new Date(today);
|
||||
check.setDate(check.getDate() + i);
|
||||
const dow = check.getDay();
|
||||
if (dow === 0 || dow === 6) continue; // Skip weekends
|
||||
const dateStr = check.toISOString().split('T')[0];
|
||||
if (cachedDates.has(dateStr)) coveredDays++;
|
||||
const ageMin = Math.round(ageMs / 60000);
|
||||
if (ageMs > 60 * 60 * 1000) {
|
||||
console.log(`[Cache] Stale: ${ageMin}min old (max 60)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
return coveredDays >= 5;
|
||||
// Condition 2: Data for current week exists
|
||||
const thisWeek = getISOWeek(new Date());
|
||||
const thisYear = getWeekYear(new Date());
|
||||
const hasCurrentWeek = allWeeks.some(w => w.weekNumber === thisWeek && w.year === thisYear && w.days && w.days.length > 0);
|
||||
|
||||
console.log(`[Cache] Age: ${ageMin}min, KW${thisWeek}: ${hasCurrentWeek ? 'vorhanden' : 'fehlt'}`);
|
||||
return hasCurrentWeek;
|
||||
}
|
||||
|
||||
// === Menu Data Fetching (Direct from Bessa API) ===
|
||||
|
||||
Reference in New Issue
Block a user