[O] Cache grading periods

This commit is contained in:
Hykilpikonna
2019-12-07 12:25:37 -05:00
parent 6f2c5feef6
commit 4090ec125a
+4
View File
@@ -180,10 +180,13 @@ export default class Course
* Get currently selected grading periods * Get currently selected grading periods
*/ */
get gradingPeriods(): number[] get gradingPeriods(): number[]
{
return this.cache.get('GradingPeriods', () =>
{ {
let timeCode = Navigation.instance.getSelectedGradingPeriod(); let timeCode = Navigation.instance.getSelectedGradingPeriod();
return (timeCode == -1 ? [0, 1, 2, 3] : [timeCode]).filter(term => return (timeCode == -1 ? [0, 1, 2, 3] : [timeCode]).filter(term =>
this.termAssignments[term].filter(a => a.graded).length != 0); this.termAssignments[term].filter(a => a.graded).length != 0);
})
} }
/** /**
@@ -211,6 +214,7 @@ export default class Course
}) })
} }
get numericGrade()
/** /**
* Get numeric grade by term * Get numeric grade by term
* *