[+] Map classinfo to courseinfo
This commit is contained in:
@@ -12,6 +12,7 @@ export default class CourseInfo
|
|||||||
courseCount: number
|
courseCount: number
|
||||||
gradeLevels: number[]
|
gradeLevels: number[]
|
||||||
enrollments: number
|
enrollments: number
|
||||||
|
classes: ClassInfo[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct with a json object
|
* Construct with a json object
|
||||||
|
|||||||
@@ -38,7 +38,15 @@ export default class CourseSelection extends Vue
|
|||||||
let info = new CourseInfo(json);
|
let info = new CourseInfo(json);
|
||||||
|
|
||||||
// Index
|
// Index
|
||||||
info.courseIds.forEach(id => this.courseIdIndex[id] = index);
|
info.courseIds.forEach(id =>
|
||||||
|
{
|
||||||
|
this.courseIdIndex[id] = index;
|
||||||
|
|
||||||
|
// Add class info into course
|
||||||
|
let classInfo = this.classes.find(c => c.id == id)
|
||||||
|
if (classInfo == null) return;
|
||||||
|
info.classes.push(classInfo);
|
||||||
|
});
|
||||||
return info;
|
return info;
|
||||||
});
|
});
|
||||||
this.directory = result.data.studentInfos;
|
this.directory = result.data.studentInfos;
|
||||||
|
|||||||
Reference in New Issue
Block a user