[O] Get assignments return all selected terms assignments

This commit is contained in:
Hykilpikonna
2019-12-07 11:25:23 -05:00
parent 99f1a4c58a
commit 8846a8be5d
+3 -21
View File
@@ -174,29 +174,11 @@ export default class Course
/**
* Get assignments of the selected time
*/
get rawSelectedAssignments(): Assignment[]
{
let timeCode = Navigation.instance.getSelectedGradingPeriod();
// All year
if (timeCode == -1)
{
return this.rawAssignments;
}
// Specific time
return this.computed.termAssignments[timeCode];
}
/**
* Get graded assignments
*/
get assignments(): Assignment[]
{
return this.cache.get('Assignments', () =>
{
return this.rawSelectedAssignments.filter(a => a.complete == 'Complete');
});
return this.gradingPeriods
.flatMap(term => this.computed.termAssignments[term])
.filter(a => a.complete == 'Complete');
}
/**