aboutsummaryrefslogtreecommitdiff
path: root/js/mock.js
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-07-01 18:34:18 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-07-01 18:34:18 +0200
commit38456da30c1729ef3696ec935f19dfa982e07ec7 (patch)
tree9ec83b5b9327b114b83ca72fc95a480d1e53685c /js/mock.js
parentd15e27a939c1095a231eebc3629663fa48b5f521 (diff)
downloadbycs-sol-38456da30c1729ef3696ec935f19dfa982e07ec7.tar.gz
bycs-sol-38456da30c1729ef3696ec935f19dfa982e07ec7.zip
implement observation and adapt graduation code to the separate databases
Diffstat (limited to 'js/mock.js')
-rw-r--r--js/mock.js32
1 files changed, 18 insertions, 14 deletions
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,
};