From 38456da30c1729ef3696ec935f19dfa982e07ec7 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 1 Jul 2026 18:34:18 +0200 Subject: implement observation and adapt graduation code to the separate databases --- js/mock.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'js/mock.js') diff --git a/js/mock.js b/js/mock.js index e4aca53..803cffb 100644 --- a/js/mock.js +++ b/js/mock.js @@ -3,9 +3,9 @@ import { Student } from "./student-common.js"; import { buildGroups } from "./group.js"; const students = [ - new Student(1, 'foo bar', ['test']), - new Student(2, 'maxi mustermensch', ['test']), - new Student(3, 'b b b', ['5a']) + new Student(1, 'foo bar', 'test'), + new Student(2, 'maxi mustermensch', 'test'), + new Student(3, 'b b b', '5a') ]; // Build the groups from our mock students @@ -40,20 +40,20 @@ for (const s of students) { switch (s.name) { case "foo bar": graduationChanges[s.name] = [ - GraduationChange.newGreenPointChange(s, "", "Florian Fischer"), - GraduationChange.newOrangePointChange(s, "", "Florian Fischer"), + GraduationChange.newGreenPointChange("Gute Arbeit", "Florian Fischer"), + GraduationChange.newOrangePointChange("", "Florian Fischer"), ]; break; case "maxi mustermensch": graduationChanges[s.name] = [ - GraduationChange.newGreenPointChange(s, "", "Florian Fischer"), - GraduationChange.newGreenPointChange(s, "", "Florian Fischer"), - new GraduationChange(new Date(), s.id, s.name, "Änderung", "", "", '{"type": "ObservationStart"}'), + GraduationChange.newGreenPointChange("", "Florian Fischer"), + GraduationChange.newGreenPointChange("", "Florian Fischer"), + new GraduationChange(new Date(), "ObservationStart", "", "Florian Fischer", ""), ]; break; case "b b b": graduationChanges[s.name] = [ - GraduationChange.newRedPointChange(s, "", "Florian Fischer"), + GraduationChange.newRedPointChange("", "Florian Fischer"), ]; } // Build the student's graduation @@ -72,11 +72,14 @@ function fetchGraduationMock(s) { } function submitGraduationChangeMock(s, c) { - if (s.graduation) { - s.graduation.addChange(c); - } else { - s.graduation = Graduation.from(s, [c]); - } + assert(s.graduation, "no graduation") + s.graduation.addChange(c); +} + +function submitObservationMock(s, o) { + assert(s.graduation, "no graduation") + assert(s.graduation.observation, "no observation period") + s.graduation.observation.addObservation(o); } export { @@ -85,4 +88,5 @@ export { fetchProgressMock, fetchGraduationMock, submitGraduationChangeMock, + submitObservationMock, }; -- cgit v1.2.3