[+] Filter assignments into terms

This commit is contained in:
Hykilpikonna
2019-11-06 17:26:44 -05:00
parent c40c5b6b94
commit 5b902171c8
+13
View File
@@ -187,6 +187,19 @@ export default class App extends Vue
// Sort by date
course.assignments.sort((a, b) => a.date.getTime() - b.date.getTime());
// Filter assignments into terms
let termAssignments: Assignment[][] = [[], [], [], []];
let currentTerm = 0;
course.assignments.forEach(a =>
{
// On to the next term
if (currentTerm < 3 && a.date > Constants.TERMS[currentTerm + 1])
currentTerm ++;
// Push data
termAssignments[currentTerm].push(a);
});
}
else throw new Error(response.data);
})