Merge pull request #5 from TauNeutrino/remove-console-logs-2603846512127419944

🧹 [code health] remove leftover console.log statements
This commit is contained in:
Michael
2026-03-10 13:40:13 +01:00
committed by GitHub
3 changed files with 1 additions and 33 deletions

View File

@@ -13,7 +13,6 @@ export function updateAuthUI() {
if (akita) { if (akita) {
const parsed = JSON.parse(akita); const parsed = JSON.parse(akita);
if (parsed.auth && parsed.auth.token) { if (parsed.auth && parsed.auth.token) {
console.log('Found existing Bessa session!');
setAuthToken(parsed.auth.token); setAuthToken(parsed.auth.token);
localStorage.setItem('kantine_authToken', parsed.auth.token); localStorage.setItem('kantine_authToken', parsed.auth.token);
@@ -74,7 +73,6 @@ export async function fetchOrders() {
} }
} }
setOrderMap(newOrderMap); setOrderMap(newOrderMap);
console.log(`Fetched ${results.length} orders, mapped active ones.`);
renderVisibleWeeks(); renderVisibleWeeks();
updateNextWeekBadge(); updateNextWeekBadge();
} }
@@ -546,20 +544,17 @@ export function startPolling() {
if (pollIntervalId) return; if (pollIntervalId) return;
if (!authToken) return; if (!authToken) return;
setPollIntervalId(setInterval(() => pollFlaggedItems(), POLL_INTERVAL_MS)); setPollIntervalId(setInterval(() => pollFlaggedItems(), POLL_INTERVAL_MS));
console.log('Polling started (every 5 min)');
} }
export function stopPolling() { export function stopPolling() {
if (pollIntervalId) { if (pollIntervalId) {
clearInterval(pollIntervalId); clearInterval(pollIntervalId);
setPollIntervalId(null); setPollIntervalId(null);
console.log('Polling stopped');
} }
} }
export async function pollFlaggedItems() { export async function pollFlaggedItems() {
if (userFlags.size === 0 || !authToken) return; if (userFlags.size === 0 || !authToken) return;
console.log(`Polling ${userFlags.size} flagged items...`);
for (const flagId of userFlags) { for (const flagId of userFlags) {
const [date, articleIdStr] = flagId.split('_'); const [date, articleIdStr] = flagId.split('_');
@@ -667,12 +662,10 @@ export function loadMenuCache() {
try { try {
const cached = localStorage.getItem(CACHE_KEY); const cached = localStorage.getItem(CACHE_KEY);
const cachedTs = localStorage.getItem(CACHE_TS_KEY); const cachedTs = localStorage.getItem(CACHE_TS_KEY);
console.log(`[Cache] localStorage: key=${!!cached} (${cached ? cached.length : 0} chars), ts=${cachedTs}`);
if (cached) { if (cached) {
setAllWeeks(JSON.parse(cached)); setAllWeeks(JSON.parse(cached));
setCurrentWeekNumber(getISOWeek(new Date())); setCurrentWeekNumber(getISOWeek(new Date()));
setCurrentYear(new Date().getFullYear()); setCurrentYear(new Date().getFullYear());
console.log(`[Cache] Parsed ${allWeeks.length} weeks:`, allWeeks.map(w => `KW${w.weekNumber}/${w.year} (${(w.days || []).length} days)`));
renderVisibleWeeks(); renderVisibleWeeks();
updateNextWeekBadge(); updateNextWeekBadge();
updateAlarmBell(); updateAlarmBell();
@@ -690,12 +683,8 @@ export function loadMenuCache() {
}); });
}); });
}); });
const res = Array.from(uniqueMenus).join('\n\n');
console.log("=== GEFUNDENE MENÜ-TEXTE (" + uniqueMenus.size + ") ===");
console.log(res);
} catch (e) { } } catch (e) { }
console.log('Loaded menu from cache');
return true; return true;
} }
} catch (e) { } catch (e) {
@@ -707,14 +696,11 @@ export function loadMenuCache() {
export function isCacheFresh() { export function isCacheFresh() {
const cachedTs = localStorage.getItem(CACHE_TS_KEY); const cachedTs = localStorage.getItem(CACHE_TS_KEY);
if (!cachedTs) { if (!cachedTs) {
console.log('[Cache] No timestamp found');
return false; return false;
} }
const ageMs = Date.now() - new Date(cachedTs).getTime(); const ageMs = Date.now() - new Date(cachedTs).getTime();
const ageMin = Math.round(ageMs / 60000);
if (ageMs > 60 * 60 * 1000) { if (ageMs > 60 * 60 * 1000) {
console.log(`[Cache] Stale: ${ageMin}min old (max 60)`);
return false; return false;
} }
@@ -722,7 +708,6 @@ export function isCacheFresh() {
const thisYear = getWeekYear(new Date()); const thisYear = getWeekYear(new Date());
const hasCurrentWeek = allWeeks.some(w => w.weekNumber === thisWeek && w.year === thisYear && w.days && w.days.length > 0); const hasCurrentWeek = allWeeks.some(w => w.weekNumber === thisWeek && w.year === thisYear && w.days && w.days.length > 0);
console.log(`[Cache] Age: ${ageMin}min, looking for KW${thisWeek}/${thisYear}, found: ${hasCurrentWeek}`);
return hasCurrentWeek; return hasCurrentWeek;
} }
@@ -781,9 +766,6 @@ export async function loadMenuDataFromAPI() {
if (detailResp.ok) { if (detailResp.ok) {
const detailData = await detailResp.json(); const detailData = await detailResp.json();
if (completed === 0) {
console.log('[Kantine Debug] Raw API response for', dateStr, ':', JSON.stringify(detailData).substring(0, 2000));
}
const menuGroups = detailData.results || []; const menuGroups = detailData.results || [];
let dayItems = []; let dayItems = [];
for (const group of menuGroups) { for (const group of menuGroups) {
@@ -792,10 +774,6 @@ export async function loadMenuDataFromAPI() {
} }
} }
if (dayItems.length > 0) { if (dayItems.length > 0) {
if (completed === 0) {
console.log('[Kantine Debug] First item keys:', Object.keys(dayItems[0]));
console.log('[Kantine Debug] First item:', JSON.stringify(dayItems[0]).substring(0, 500));
}
allDays.push({ allDays.push({
date: dateStr, date: dateStr,
menu_items: dayItems, menu_items: dayItems,

View File

@@ -4,9 +4,7 @@ import { updateAuthUI, cleanupExpiredFlags, loadMenuCache, isCacheFresh, loadMen
import { checkForUpdates } from './ui_helpers.js'; import { checkForUpdates } from './ui_helpers.js';
import { authToken } from './state.js'; import { authToken } from './state.js';
if (window.__KANTINE_LOADED) { if (!window.__KANTINE_LOADED) {
console.log("Kantine Wrapper already loaded.");
} else {
window.__KANTINE_LOADED = true; window.__KANTINE_LOADED = true;
injectUI(); injectUI();
@@ -18,10 +16,7 @@ if (window.__KANTINE_LOADED) {
if (hadCache) { if (hadCache) {
document.getElementById('loading').classList.add('hidden'); document.getElementById('loading').classList.add('hidden');
if (!isCacheFresh()) { if (!isCacheFresh()) {
console.log('Cache stale or incomplete refreshing from API');
loadMenuDataFromAPI(); loadMenuDataFromAPI();
} else {
console.log('Cache fresh & complete skipping API refresh');
} }
} else { } else {
loadMenuDataFromAPI(); loadMenuDataFromAPI();
@@ -33,6 +28,4 @@ if (window.__KANTINE_LOADED) {
checkForUpdates(); checkForUpdates();
setInterval(checkForUpdates, 60 * 60 * 1000); setInterval(checkForUpdates, 60 * 60 * 1000);
console.log('Kantine Wrapper loaded ✅');
} }

View File

@@ -454,12 +454,9 @@ export async function checkForUpdates() {
})); }));
const latest = versions[0].tag; const latest = versions[0].tag;
console.log(`[Kantine] Version Check: Local [${currentVersion}] vs Latest [${latest}] (${devMode ? 'dev' : 'stable'})`);
if (!isNewer(latest, currentVersion)) return; if (!isNewer(latest, currentVersion)) return;
console.log(`[Kantine] Update verfügbar: ${latest}`);
const headerTitle = document.querySelector('.header-left h1'); const headerTitle = document.querySelector('.header-left h1');
if (headerTitle && !headerTitle.querySelector('.update-icon')) { if (headerTitle && !headerTitle.querySelector('.update-icon')) {
const icon = document.createElement('a'); const icon = document.createElement('a');