diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/config.js | 13 | ||||
| -rw-r--r-- | js/graduation-common.js | 17 |
2 files changed, 8 insertions, 22 deletions
diff --git a/js/config.js b/js/config.js index 2beb91b..cc72f73 100644 --- a/js/config.js +++ b/js/config.js @@ -2,19 +2,10 @@ const GRADUATION_DB_ID = 262744; const GRADUATION_ACTIVITY_ID = 92663494; const GRADUATION_DB_PARAMS_MAP = { id: "f_1133275", - name: "f_1130848", - group: "f_1130869", + name: "f_1139335", change: "f_1133254", reason: "f_1130860", - date: (date) => { - return { - f_1130863_d: date.getDate(), - f_1130863_m: date.getMonth(), - f_1130863_y: date.getFullYear(), - f_1130863_z: 1, - }; - }, - coach: "f_1130866", + json: "f_1133251", } const courseId = 2466361; 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); |
