[F] Fix term 1 displaying term 2 grades issue

This commit is contained in:
Hykilpikonna
2019-11-07 22:00:08 -05:00
parent 2f30e67671
commit adfebc8c44
+10 -2
View File
@@ -130,14 +130,18 @@ export default class Course
return this.computed.termAssignments[timeCode];
}
// TODO: Optimize this
private letterGradeComputed = false;
/**
* Get letter grade
*/
get letterGrade(): string
{
// Cached
if (this.rawLetterGrade != undefined)
if (this.rawLetterGrade != undefined && this.letterGradeComputed)
return this.rawLetterGrade;
this.letterGradeComputed = true;
// Get scale
let scale = GPAUtils.findScale(this.numericGrade);
@@ -149,14 +153,17 @@ export default class Course
return this.rawLetterGrade = scale.letter;
}
private numericGradeComputed = false;
/**
* Get numeric grade
*/
get numericGrade(): number
{
// Cached
if (this.rawNumericGrade != undefined)
if (this.rawNumericGrade != undefined && this.numericGradeComputed)
return this.rawNumericGrade;
this.numericGradeComputed = true;
// Calculate
if (this.grading.method == 'PERCENT_TYPE')
@@ -168,6 +175,7 @@ export default class Course
return this.rawNumericGrade = GPAUtils.getTotalMeanAverage(this.assignments);
}
// Error
return -1;
}
}