// Terminprüfung: welche Meilensteine sind gefährdet?function pruefeTermine(meilensteine, heute) { return meilensteine .filter(m => !m.erledigt) .map(m => { const tage = arbeitstage(heute, m.faellig); const ampel = tage < 0 ? 'rot' : tage <= 30 ? 'gelb' : 'grün'; return { ...m, tage, ampel }; });}// Planlauf: Freigabe erst nach allen Prüfungenasync function gibPlanFrei(plan) { const offen = plan.pruefungen.filter(p => p.status !== 'geprüft'); if (offen.length > 0) { return melde(offen.length + ' Prüfungen offen', plan.index); } plan.status = 'freigegeben'; await speichere(plan);}// Last Planner: Aufgaben der nächsten sechs Wochenfunction wochenplan(aufgaben, start) { const ende = plusWochen(start, 6); return aufgaben.filter(a => a.beginn >= start && a.beginn < ende) .sort((a, b) => a.beginn - b.beginn);}// Hindernisse sammeln und nachverfolgenfunction hindernisse(aufgaben) { return aufgaben.flatMap(a => a.hindernisse).filter(h => !h.geloest);}// Terminprüfung: welche Meilensteine sind gefährdet?function pruefeTermine(meilensteine, heute) { return meilensteine .filter(m => !m.erledigt) .map(m => { const tage = arbeitstage(heute, m.faellig); const ampel = tage < 0 ? 'rot' : tage <= 30 ? 'gelb' : 'grün'; return { ...m, tage, ampel }; });}// Planlauf: Freigabe erst nach allen Prüfungenasync function gibPlanFrei(plan) { const offen = plan.pruefungen.filter(p => p.status !== 'geprüft'); if (offen.length > 0) { return melde(offen.length + ' Prüfungen offen', plan.index); } plan.status = 'freigegeben'; await speichere(plan);}// Last Planner: Aufgaben der nächsten sechs Wochenfunction wochenplan(aufgaben, start) { const ende = plusWochen(start, 6); return aufgaben.filter(a => a.beginn >= start && a.beginn < ende) .sort((a, b) => a.beginn - b.beginn);}// Hindernisse sammeln und nachverfolgenfunction hindernisse(aufgaben) { return aufgaben.flatMap(a => a.hindernisse).filter(h => !h.geloest);}