[M] Rename assignments to rawAssignments

This commit is contained in:
Hykilpikonna
2019-11-06 19:12:24 -05:00
parent e7563fcfb5
commit 79bb10b14e
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ export default class App extends Vue
});
// Wait for assignments to be ready.
pWaitFor(() => this.courses.every(c => c.assignments != null)).then(() =>
pWaitFor(() => this.courses.every(c => c.rawAssignments != null)).then(() =>
{
// Filter courses
this.filteredCourses = this.courses.filter(c => c.isGraded);
+7 -6
View File
@@ -1,8 +1,9 @@
import {Assignment} from '@/components/app/app';
import App, {Assignment} from '@/components/app/app';
import JsonUtils from '@/utils/json-utils';
import Constants from '@/constants';
import {FormatUtils} from '@/utils/format-utils';
import {CourseUtils} from '@/utils/course-utils';
import Navigation from '@/components/navigation/navigation';
export default class Course
{
@@ -11,7 +12,7 @@ export default class Course
name: string;
teacherName: string;
status: string;
assignments: Assignment[];
rawAssignments: Assignment[];
letterGrade?: string;
numericGrade?: number;
@@ -68,19 +69,19 @@ export default class Course
{
// Load assignments
// Parse json and filter it
this.assignments = JsonUtils.filterAssignments(data);
this.rawAssignments = JsonUtils.filterAssignments(data);
// Sort by date (Latest is at 0)
this.assignments.sort((a, b) => b.date.getTime() - a.date.getTime());
this.rawAssignments.sort((a, b) => b.date.getTime() - a.date.getTime());
// Filter assignments into terms
let termAssignments: Assignment[][] = [[], [], [], []];
let currentTerm = 0;
// Loop through it by time order
for (let i = this.assignments.length - 1; i >= 0; i--)
for (let i = this.rawAssignments.length - 1; i >= 0; i--)
{
let a = this.assignments[i];
let a = this.rawAssignments[i];
// On to the next term
if (currentTerm < 3 && a.date > Constants.TERMS[currentTerm + 1])