From 3400c07e773cfb05229839dcdd2bfade1bc10660 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 6 Nov 2019 19:13:45 -0500 Subject: [PATCH] [+] Encapsulate method to get assignments of specific time --- src/logic/course.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/logic/course.ts b/src/logic/course.ts index c4e74cb..6f02ec0 100644 --- a/src/logic/course.ts +++ b/src/logic/course.ts @@ -121,4 +121,21 @@ export default class Course // Is graded return true; } + + /** + * Get assignments of the selected time + */ + get assignments(): Assignment[] + { + let timeCode = Navigation.instance.getSelectedTimeCode(); + + // All year + if (timeCode == -1) + { + return this.rawAssignments; + } + + // Specific time + return this.computed.termAssignments[timeCode]; + } }