[+] Encapsulate getAssignmentsBefore(date)
This commit is contained in:
@@ -3,6 +3,7 @@ import {CourseUtils} from '@/logic/utils/course-utils';
|
|||||||
import Navigation from '@/components/navigation/navigation';
|
import Navigation from '@/components/navigation/navigation';
|
||||||
import {GPAUtils} from '@/logic/utils/gpa-utils';
|
import {GPAUtils} from '@/logic/utils/gpa-utils';
|
||||||
import CacheUtils from '@/logic/utils/cache-utils';
|
import CacheUtils from '@/logic/utils/cache-utils';
|
||||||
|
import Constants from '@/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Objects of this interface represent assignment grades.
|
* Objects of this interface represent assignment grades.
|
||||||
@@ -198,6 +199,19 @@ export default class Course
|
|||||||
.filter(a => a.graded);
|
.filter(a => a.graded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get assignments before a certain date
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
*/
|
||||||
|
getAssignmentsBefore(date: Date): {term: number, assignments: Assignment[]}
|
||||||
|
{
|
||||||
|
let term = Constants.getTerm(date);
|
||||||
|
let assignments = this.assignments.filter(a => a.time <= date.getTime());
|
||||||
|
|
||||||
|
return {term: term, assignments: assignments}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get letter grade
|
* Get letter grade
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user