From 4090ec125a7755bfe99692d82d89a7856d7a73da Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 7 Dec 2019 12:25:37 -0500 Subject: [PATCH] [O] Cache grading periods --- src/logic/course.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/logic/course.ts b/src/logic/course.ts index 6d6ff55..dc75398 100644 --- a/src/logic/course.ts +++ b/src/logic/course.ts @@ -181,9 +181,12 @@ export default class Course */ get gradingPeriods(): number[] { - let timeCode = Navigation.instance.getSelectedGradingPeriod(); - return (timeCode == -1 ? [0, 1, 2, 3] : [timeCode]).filter(term => - this.termAssignments[term].filter(a => a.graded).length != 0); + return this.cache.get('GradingPeriods', () => + { + let timeCode = Navigation.instance.getSelectedGradingPeriod(); + return (timeCode == -1 ? [0, 1, 2, 3] : [timeCode]).filter(term => + this.termAssignments[term].filter(a => a.graded).length != 0); + }) } /** @@ -211,6 +214,7 @@ export default class Course }) } + get numericGrade() /** * Get numeric grade by term *