+6
-5
@@ -4,7 +4,6 @@ import {CourseUtils} from '@/logic/utils/course-utils';
|
||||
import Navigation from '@/components/navigation/navigation';
|
||||
import {GPAUtils} from '@/logic/utils/gpa-utils';
|
||||
import CacheUtils from '@/logic/utils/cache-utils';
|
||||
import cache from '@/logic/utils/cache-utils';
|
||||
|
||||
/**
|
||||
* Objects of this interface represent assignment grades.
|
||||
@@ -68,6 +67,8 @@ export default class Course
|
||||
allYearGrade: number
|
||||
};
|
||||
|
||||
cache: CacheUtils = new CacheUtils();
|
||||
|
||||
/**
|
||||
* Construct a course with a course json object
|
||||
*
|
||||
@@ -171,7 +172,7 @@ export default class Course
|
||||
*/
|
||||
get assignments(): Assignment[]
|
||||
{
|
||||
return cache('Assignments', () =>
|
||||
return this.cache.get('Assignments', () =>
|
||||
{
|
||||
return this.rawSelectedAssignments.filter(a => a.complete == 'Complete');
|
||||
});
|
||||
@@ -182,7 +183,7 @@ export default class Course
|
||||
*/
|
||||
get letterGrade(): string
|
||||
{
|
||||
return cache('LetterGrade', () =>
|
||||
return this.cache.get('LetterGrade', () =>
|
||||
{
|
||||
// Get scale
|
||||
let scale = GPAUtils.findScale(this.numericGrade);
|
||||
@@ -197,7 +198,7 @@ export default class Course
|
||||
*/
|
||||
get numericGrade(): number
|
||||
{
|
||||
return cache('NumericGrade', () =>
|
||||
return this.cache.get('NumericGrade', () =>
|
||||
{
|
||||
// Calculate
|
||||
if (this.grading.method == 'PERCENT_TYPE')
|
||||
@@ -217,7 +218,7 @@ export default class Course
|
||||
*/
|
||||
get assignmentTypes(): AssignmentType[]
|
||||
{
|
||||
return cache('AssignmentTypes', () =>
|
||||
return this.cache.get('AssignmentTypes', () =>
|
||||
{
|
||||
// Get all types
|
||||
let types = this.assignments.map(a => a.type);
|
||||
|
||||
Reference in New Issue
Block a user