From 1e91cec8d2952eaa7b4db70800f043579477de0b Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 6 Nov 2019 18:08:47 -0500 Subject: [PATCH] [O] Create course objects after parsing json --- src/components/app/app.ts | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/components/app/app.ts b/src/components/app/app.ts index 4b06e10..9f34284 100644 --- a/src/components/app/app.ts +++ b/src/components/app/app.ts @@ -11,6 +11,7 @@ import {GPAUtils} from '@/utils/gpa-utils'; import Loading from '@/components/loading/loading.vue'; import CoursePage from '@/pages/course/course-page.vue'; import {FormatUtils} from '@/utils/format-utils'; +import Course from '@/logic/course'; /** @@ -34,38 +35,6 @@ export interface Assignment score: number } -/** - * A course - */ -export interface Course -{ - assignmentsId: number - id: number - name: string - teacherName: string - status: string - - letterGrade?: string - numericGrade?: number - - level: string - scaleUp: number - - grading: - { - method: string - weightingMap: {[index: string]: number} - } - - computed: - { - termAssignments: Assignment[][] - allYearGrade: number - } - - assignments: Assignment[] -} - @Component({ components: {Login, Navigation, Overall, Loading, CoursePage}, }) @@ -151,7 +120,7 @@ export default class App extends Vue if (response.success) { // Save courses - this.courses = response.data; + this.courses = response.data.map((courseJson: any) => new Course(courseJson)); // Post processing CourseUtils.postProcess(this.courses);