[O] Parse courseIDs
This commit is contained in:
@@ -6,7 +6,7 @@ export default class CourseInfo
|
|||||||
name: string
|
name: string
|
||||||
teacher: string
|
teacher: string
|
||||||
level: string
|
level: string
|
||||||
courseIds: string
|
courseIds: number[]
|
||||||
|
|
||||||
uniqueName: string
|
uniqueName: string
|
||||||
courseCount: number
|
courseCount: number
|
||||||
@@ -24,10 +24,10 @@ export default class CourseInfo
|
|||||||
this.name = json.name.trim()
|
this.name = json.name.trim()
|
||||||
this.teacher = json.teacher
|
this.teacher = json.teacher
|
||||||
this.level = json.level
|
this.level = json.level
|
||||||
this.courseIds = json.courseIds
|
this.courseIds = json.courseIds.split('|').map((id: string) => +id);
|
||||||
|
|
||||||
this.uniqueName = this.name.replace(/( A| CP| H)$/g, '')
|
this.uniqueName = this.name.replace(/( A| CP| H)$/g, '')
|
||||||
this.courseCount = this.courseIds.split('|').length;
|
this.courseCount = this.courseIds.length;
|
||||||
this.gradeLevels = [];
|
this.gradeLevels = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user