fix(flags): properly remove expired flags from localstorage (v1.4.15)
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
## v1.4.15
|
||||||
|
- 🧹 **Bugfix**: In der Vergangenheit gesetzte Alarme/Flags wurden nicht zuverlässig gelöscht. Dies ist nun behoben, sodass verfallene Menüs nach 10:00 Uhr bzw. an vergangenen Tagen automatisch aus dem Tracker verschwinden.
|
||||||
|
|
||||||
## v1.4.14
|
## v1.4.14
|
||||||
- 🐛 **Bugfix**: Alarmglocke versteckt sich jetzt zuverlässig auch auf Endgeräten mit CSS Konflikten
|
- 🐛 **Bugfix**: Alarmglocke versteckt sich jetzt zuverlässig auch auf Endgeräten mit CSS Konflikten
|
||||||
- 🚀 **Feature**: Sofortige API-Aktualisierung (Refresh) bei Aktivierung eines Menüalarms
|
- 🚀 **Feature**: Sofortige API-Aktualisierung (Refresh) bei Aktivierung eines Menüalarms
|
||||||
|
|||||||
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
16
dist/install.html
vendored
16
dist/install.html
vendored
File diff suppressed because one or more lines are too long
31
dist/kantine-standalone.html
vendored
31
dist/kantine-standalone.html
vendored
@@ -2021,7 +2021,7 @@ body {
|
|||||||
<div class="brand">
|
<div class="brand">
|
||||||
<span class="material-icons-round logo-icon">restaurant_menu</span>
|
<span class="material-icons-round logo-icon">restaurant_menu</span>
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<h1>Kantinen Übersicht <small class="version-tag" style="font-size: 0.6em; opacity: 0.7; font-weight: 400; cursor: pointer;" title="Klick für Versionsmenü">v1.4.14</small></h1>
|
<h1>Kantinen Übersicht <small class="version-tag" style="font-size: 0.6em; opacity: 0.7; font-weight: 400; cursor: pointer;" title="Klick für Versionsmenü">v1.4.15</small></h1>
|
||||||
<div id="last-updated-subtitle" class="subtitle"></div>
|
<div id="last-updated-subtitle" class="subtitle"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-group" style="margin-left: 1rem;">
|
<div class="nav-group" style="margin-left: 1rem;">
|
||||||
@@ -2163,7 +2163,7 @@ body {
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div style="margin-bottom: 1rem;">
|
<div style="margin-bottom: 1rem;">
|
||||||
<strong>Aktuell:</strong> <span id="version-current">v1.4.14</span>
|
<strong>Aktuell:</strong> <span id="version-current">v1.4.15</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dev-toggle">
|
<div class="dev-toggle">
|
||||||
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
|
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
|
||||||
@@ -3034,12 +3034,27 @@ body {
|
|||||||
// FR-019: Auto-remove flags whose cutoff has passed
|
// FR-019: Auto-remove flags whose cutoff has passed
|
||||||
function cleanupExpiredFlags() {
|
function cleanupExpiredFlags() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
const todayStr = now.toISOString().split('T')[0]; // Format: YYYY-MM-DD
|
||||||
let changed = false;
|
let changed = false;
|
||||||
|
|
||||||
for (const flagId of [...userFlags]) {
|
for (const flagId of [...userFlags]) {
|
||||||
const [date] = flagId.split('_');
|
const [dateStr] = flagId.split('_'); // Format usually is YYYY-MM-DD
|
||||||
const cutoff = new Date(date);
|
|
||||||
cutoff.setHours(10, 0, 0, 0); // Standard cutoff 10:00
|
// If the flag's date string is entirely in the past (before today)
|
||||||
if (now >= cutoff) {
|
// or if it's today but past the 10:00 cutoff time
|
||||||
|
let isExpired = false;
|
||||||
|
|
||||||
|
if (dateStr < todayStr) {
|
||||||
|
isExpired = true;
|
||||||
|
} else if (dateStr === todayStr) {
|
||||||
|
const cutoff = new Date(dateStr);
|
||||||
|
cutoff.setHours(10, 0, 0, 0); // Standard cutoff 10:00
|
||||||
|
if (now >= cutoff) {
|
||||||
|
isExpired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExpired) {
|
||||||
userFlags.delete(flagId);
|
userFlags.delete(flagId);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -3969,7 +3984,7 @@ body {
|
|||||||
|
|
||||||
// Periodic update check (runs on init + every hour)
|
// Periodic update check (runs on init + every hour)
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
const currentVersion = 'v1.4.14';
|
const currentVersion = 'v1.4.15';
|
||||||
const devMode = localStorage.getItem('kantine_dev_mode') === 'true';
|
const devMode = localStorage.getItem('kantine_dev_mode') === 'true';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -4010,7 +4025,7 @@ body {
|
|||||||
const modal = document.getElementById('version-modal');
|
const modal = document.getElementById('version-modal');
|
||||||
const container = document.getElementById('version-list-container');
|
const container = document.getElementById('version-list-container');
|
||||||
const devToggle = document.getElementById('dev-mode-toggle');
|
const devToggle = document.getElementById('dev-mode-toggle');
|
||||||
const currentVersion = 'v1.4.14';
|
const currentVersion = 'v1.4.15';
|
||||||
|
|
||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
modal.classList.remove('hidden');
|
modal.classList.remove('hidden');
|
||||||
|
|||||||
23
kantine.js
23
kantine.js
@@ -1084,12 +1084,27 @@
|
|||||||
// FR-019: Auto-remove flags whose cutoff has passed
|
// FR-019: Auto-remove flags whose cutoff has passed
|
||||||
function cleanupExpiredFlags() {
|
function cleanupExpiredFlags() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
const todayStr = now.toISOString().split('T')[0]; // Format: YYYY-MM-DD
|
||||||
let changed = false;
|
let changed = false;
|
||||||
|
|
||||||
for (const flagId of [...userFlags]) {
|
for (const flagId of [...userFlags]) {
|
||||||
const [date] = flagId.split('_');
|
const [dateStr] = flagId.split('_'); // Format usually is YYYY-MM-DD
|
||||||
const cutoff = new Date(date);
|
|
||||||
cutoff.setHours(10, 0, 0, 0); // Standard cutoff 10:00
|
// If the flag's date string is entirely in the past (before today)
|
||||||
if (now >= cutoff) {
|
// or if it's today but past the 10:00 cutoff time
|
||||||
|
let isExpired = false;
|
||||||
|
|
||||||
|
if (dateStr < todayStr) {
|
||||||
|
isExpired = true;
|
||||||
|
} else if (dateStr === todayStr) {
|
||||||
|
const cutoff = new Date(dateStr);
|
||||||
|
cutoff.setHours(10, 0, 0, 0); // Standard cutoff 10:00
|
||||||
|
if (now >= cutoff) {
|
||||||
|
isExpired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExpired) {
|
||||||
userFlags.delete(flagId);
|
userFlags.delete(flagId);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v1.4.14
|
v1.4.15
|
||||||
|
|||||||
Reference in New Issue
Block a user