diff --git a/src/logic/course.ts b/src/logic/course.ts index 9dd997e..6a8a609 100644 --- a/src/logic/course.ts +++ b/src/logic/course.ts @@ -3,6 +3,7 @@ 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 Constants from '@/constants'; /** * Objects of this interface represent assignment grades. @@ -198,6 +199,19 @@ export default class Course .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 */