From 71f2eccab49738f0bd2b1fdca8e8a76d603cc8ec Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 6 Nov 2019 17:54:57 -0500 Subject: [PATCH] [F] Fix filter assignment order issue --- src/components/app/app.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/app/app.ts b/src/components/app/app.ts index 7354a3f..6175193 100644 --- a/src/components/app/app.ts +++ b/src/components/app/app.ts @@ -191,15 +191,20 @@ export default class App extends Vue // Filter assignments into terms let termAssignments: Assignment[][] = [[], [], [], []]; let currentTerm = 0; - course.assignments.forEach(a => + + // Loop through it by time order + for (let i = course.assignments.length - 1; i >= 0; i--) { + let a = course.assignments[i]; + // On to the next term if (currentTerm < 3 && a.date > Constants.TERMS[currentTerm + 1]) + { currentTerm ++; // Push data termAssignments[currentTerm].push(a); - }); + } // Set computed data course.computed = {termAssignments: termAssignments, allYearGrade: -1};