diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-06-24 09:21:44 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-06-24 09:21:44 +0200 |
| commit | 5014c218b1dd0e7831200a92d2361ad71e2f64a3 (patch) | |
| tree | 70a82b38ada10199dc3abe629232097c1d206a0e /js/graduation-common.js | |
| parent | af8585faa1aa7c39564c583963349c4a2922df9c (diff) | |
| download | bycs-sol-5014c218b1dd0e7831200a92d2361ad71e2f64a3.tar.gz bycs-sol-5014c218b1dd0e7831200a92d2361ad71e2f64a3.zip | |
simplify graduation table
Diffstat (limited to 'js/graduation-common.js')
| -rw-r--r-- | js/graduation-common.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/js/graduation-common.js b/js/graduation-common.js index 4479bec..10524d5 100644 --- a/js/graduation-common.js +++ b/js/graduation-common.js @@ -4,23 +4,20 @@ import { loadFromDatabase, addEntryToDatabaseActivity } from "./database.js" const LEVEL_NAMES = ["Beginner", "Entdecker"]; class GraduationChange { - constructor(date, id, name, group, change, reason, coach, json) { + constructor(date, id, name, change, reason, coach, json) { this.date = date; this.id = id; this.name = name; - this.group = group; this.change = change; this.reason = reason; this.coach = coach; this.json = json; } - static DB_FIELDS = ["id", "name", "group", "change", "reason", "json"]; - static newGreenPointChange(student, reason, coach) { return new GraduationChange( new Date(), - student.id, student.name, student.group, + student.id, student.name, "GrĂ¼n", reason, coach, "" ); } @@ -28,7 +25,7 @@ class GraduationChange { static newOrangePointChange(student, reason, coach) { return new GraduationChange( new Date(), - student.id, student.name, student.group, + student.id, student.name, "Orange", reason, coach, "" ); } @@ -142,7 +139,7 @@ async function fetchGraduationChanges(student) { let changes = []; for (const e of data) { - const gradChange = new GraduationChange(e.date, e.id, e.name, e.group, e.change, e.reason, e.coach, e.json); + const gradChange = new GraduationChange(e.date, e.id, e.change, e.reason, e.coach, e.json); changes.push(gradChange); } return changes; @@ -156,10 +153,8 @@ async function fetchGraduation(student) { async function submitGraduationChange(student, change) { let params = {}; student.graduation.addChange(change); - for (const key of GraduationChange.DB_FIELDS) { - if (GRADUATION_DB_PARAMS_MAP[key]) { - params[GRADUATION_DB_PARAMS_MAP[key]] = change[key]; - } + for (const key in GRADUATION_DB_PARAMS_MAP) { + params[GRADUATION_DB_PARAMS_MAP[key]] = change[key]; } addEntryToDatabaseActivity(GRADUATION_ACTIVITY_ID, params); |
