-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterms.js
23 lines (20 loc) · 944 Bytes
/
terms.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function unmetTermRequirements() {
// returns a list of the form:
// [{ group: firstFailedGroup, failedSubjects: [...] },
// { group: secondFailedGroup, failedSubjects: [...] }, ...]
return Object.entries(getSubjectsByGroup()).map(function (entry) {
var groupName = entry[0],
groupSubjects = entry[1],
group = REQUIREMENT_GROUPS[groupName],
failed = group.predicate(groupSubjects);
if (failed) return { groupName: groupName, group: group, failed: failed };
}).filter(e => e != undefined);
}
function getTotalSubjectTermsPoints(subjectName) {
var points = Object.values(subjects[subjectName].termGrades)
.filter(grade => grade.enabled)
.map(grade => (grade.grade != undefined) ? grade.grade : extrapolateFutureGrades(subjectName))
.reduce(sum, 0);
return [subjectName, points];
}
// vim:foldmethod=marker:foldlevel=0:nowrap:textwidth=0: