[O] Create course objects after parsing json
This commit is contained in:
@@ -11,6 +11,7 @@ import {GPAUtils} from '@/utils/gpa-utils';
|
|||||||
import Loading from '@/components/loading/loading.vue';
|
import Loading from '@/components/loading/loading.vue';
|
||||||
import CoursePage from '@/pages/course/course-page.vue';
|
import CoursePage from '@/pages/course/course-page.vue';
|
||||||
import {FormatUtils} from '@/utils/format-utils';
|
import {FormatUtils} from '@/utils/format-utils';
|
||||||
|
import Course from '@/logic/course';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,38 +35,6 @@ export interface Assignment
|
|||||||
score: number
|
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({
|
@Component({
|
||||||
components: {Login, Navigation, Overall, Loading, CoursePage},
|
components: {Login, Navigation, Overall, Loading, CoursePage},
|
||||||
})
|
})
|
||||||
@@ -151,7 +120,7 @@ export default class App extends Vue
|
|||||||
if (response.success)
|
if (response.success)
|
||||||
{
|
{
|
||||||
// Save courses
|
// Save courses
|
||||||
this.courses = response.data;
|
this.courses = response.data.map((courseJson: any) => new Course(courseJson));
|
||||||
|
|
||||||
// Post processing
|
// Post processing
|
||||||
CourseUtils.postProcess(this.courses);
|
CourseUtils.postProcess(this.courses);
|
||||||
|
|||||||
Reference in New Issue
Block a user