[+] Index courseIds
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
search: string = "";
|
search: string = "";
|
||||||
courseInfo: CourseInfo[] = []
|
courseInfo: CourseInfo[] = []
|
||||||
|
courseIdIndex: any = {} // Map<CourseID, index in courseInfo>
|
||||||
directory: {gradeLevel: number, classes: string}[] = []
|
directory: {gradeLevel: number, classes: string}[] = []
|
||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
@@ -78,7 +79,14 @@
|
|||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
||||||
// Parse data
|
// Parse data
|
||||||
this.courseInfo = result.data.courseInfos.map((json: any) => new CourseInfo(json));
|
this.courseInfo = result.data.courseInfos.map((json: any, index: number) =>
|
||||||
|
{
|
||||||
|
let info = new CourseInfo(json);
|
||||||
|
|
||||||
|
// Index
|
||||||
|
info.courseIds.forEach(id => this.courseIdIndex[id] = index);
|
||||||
|
return info;
|
||||||
|
});
|
||||||
this.directory = result.data.studentInfos;
|
this.directory = result.data.studentInfos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user