Module abschaltbar machen
Merkkarten, Praxisaufgaben, Checklisten, Berichtsheft, Lernzielkontrollen und Feedbackgespraech lassen sich unter Verwaltung -> Module fuer die ganze Lern-Bar ab- und einschalten. Wochenplan, Handouts, Glossar, Auswertung und Verwaltung bleiben immer an. Gesperrt wird an drei Stellen, nicht im Layout (Next rendert Layouts beim Seitenwechsel darunter nicht neu): Seiten mit erfordereModul, Routen fuer PDF, Anhaenge und Lernstand mit modulAn, alle 37 Serveraktionen der Module mit pruefeModul. Die Anmeldepruefung kommt jeweils zuerst, damit ein Unangemeldeter nicht am 404 abliest, was abgeschaltet ist. Ein abgeschaltetes Modul traegt nirgends bei: Wochenplan, Fortschritt, Was-wartet, Mein Stand, Ergebnisverlauf, Rahmenplanabdeckung, Vorschlaege fuers Berichtsheft, Karten im Handout, Kurzbefehle im Manifest. Die Lernstand-Schnittstelle antwortet mit 410, das Geraet verwirft daraufhin seine Offline-Warteschlange. Abschalten loescht nichts. Gespeichert in modul_einstellung (Migration 0010); fehlt die Zeile, ist das Modul an, eine bestehende Datenbank verhaelt sich also wie vorher. 12 Tests fuer die Regeln, Abschnitt A8 im Abnahmelauf, Anleitung Kapitel 9 mit Bildschirmfoto, README, E43. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
54ce7d87ae
commit
44e6c8bb79
@@ -7,6 +7,8 @@ import { anzahlAbgenommen } from '../repos/aufgaben';
|
||||
import { anzahlAbgeschlossen } from '../repos/checklisten';
|
||||
import { anzahlAbgegeben } from '../repos/kontrollen';
|
||||
import { heute } from '../zeit';
|
||||
import { modulStand } from '../repos/module';
|
||||
import type { ModulStand } from '../module/module';
|
||||
import { aktuelleWoche } from './wochen';
|
||||
import { wochenFortschritt, type Fortschritt } from './fortschritt';
|
||||
import type { Wochenplanung } from '../db/schema';
|
||||
@@ -34,6 +36,8 @@ export type Wochensicht = {
|
||||
aufgaben: Aufgabe[];
|
||||
checklisten: Checkliste[];
|
||||
kontrolle: Kontrolle | null;
|
||||
/** Welche Module an sind – die Ansicht blendet die übrigen aus. */
|
||||
module: ModulStand;
|
||||
vorherige: number | null;
|
||||
naechste: number | null;
|
||||
};
|
||||
@@ -66,14 +70,22 @@ export function wochensicht(ausbildungId: string, azubiId: string, wochenNummer:
|
||||
};
|
||||
});
|
||||
|
||||
const aufgaben = woche.aufgaben.map((id) => alle.aufgabeNach.get(id)).filter((a) => a !== undefined);
|
||||
const checklisten = woche.checklisten.map((id) => alle.checklisteNach.get(id)).filter((c) => c !== undefined);
|
||||
const kontrolle = woche.lernzielkontrolle ? (alle.kontrolleNach.get(woche.lernzielkontrolle) ?? null) : null;
|
||||
// Ein abgeschaltetes Modul trägt nichts zur Woche bei – weder in der Ansicht
|
||||
// noch im Fortschritt. So erreicht eine Woche auch ohne Merkkarten 100 %.
|
||||
const eingeschaltet = modulStand();
|
||||
const aufgaben = eingeschaltet.aufgaben
|
||||
? woche.aufgaben.map((id) => alle.aufgabeNach.get(id)).filter((a) => a !== undefined)
|
||||
: [];
|
||||
const checklisten = eingeschaltet.checklisten
|
||||
? woche.checklisten.map((id) => alle.checklisteNach.get(id)).filter((c) => c !== undefined)
|
||||
: [];
|
||||
const kontrolle =
|
||||
eingeschaltet.kontrollen && woche.lernzielkontrolle ? (alle.kontrolleNach.get(woche.lernzielkontrolle) ?? null) : null;
|
||||
|
||||
// Die Merkkarten dieser Woche sind die Karten ihrer Handouts.
|
||||
const karteIds = handouts.flatMap(({ handout }) =>
|
||||
alle.karten.filter((k) => k.handoutId === handout.id).map((k) => k.id),
|
||||
);
|
||||
const karteIds = eingeschaltet.karten
|
||||
? handouts.flatMap(({ handout }) => alle.karten.filter((k) => k.handoutId === handout.id).map((k) => k.id))
|
||||
: [];
|
||||
const kartenStand = kartenUebersicht(azubiId, karteIds, heuteDatum);
|
||||
|
||||
const fortschritt = wochenFortschritt({
|
||||
@@ -102,6 +114,7 @@ export function wochensicht(ausbildungId: string, azubiId: string, wochenNummer:
|
||||
aufgaben,
|
||||
checklisten,
|
||||
kontrolle,
|
||||
module: eingeschaltet,
|
||||
vorherige: stelle > 0 ? (nummern[stelle - 1] ?? null) : null,
|
||||
naechste: stelle < nummern.length - 1 ? (nummern[stelle + 1] ?? null) : null,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user