[+] Create courseInfo class
This commit is contained in:
@@ -29,11 +29,16 @@ export default class CourseInfo
|
|||||||
|
|
||||||
this.courseCount = this.courseIds.length;
|
this.courseCount = this.courseIds.length;
|
||||||
this.gradeLevels = [];
|
this.gradeLevels = [];
|
||||||
this.uniqueName = this.name
|
this.uniqueName = CourseInfo.toUniqueName(this.name);
|
||||||
|
this.enrollments = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static toUniqueName(name: string)
|
||||||
|
{
|
||||||
|
return name
|
||||||
.replace(/( Semester| Full Year|)/g, '')
|
.replace(/( Semester| Full Year|)/g, '')
|
||||||
.replace(/( Accelerated| Honors| College Prep|)/g, '')
|
.replace(/( Accelerated| Honors| College Prep|)/g, '')
|
||||||
.replace(/( A| Acc| CP| H| \(.*\))$/g, '')
|
.replace(/( A| Acc| CP| H| \(.*\))$/g, '');
|
||||||
this.enrollments = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,3 +48,28 @@ export interface UniqueCourse
|
|||||||
courses: CourseInfo[]
|
courses: CourseInfo[]
|
||||||
enrollments: number
|
enrollments: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ClassInfo
|
||||||
|
{
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
teacher: string
|
||||||
|
level: string
|
||||||
|
|
||||||
|
uniqueName: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct with a json object
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
*/
|
||||||
|
constructor(json: any)
|
||||||
|
{
|
||||||
|
this.id = json.id;
|
||||||
|
this.name = json.name.trim().replace('&', '&').replace('"', '"')
|
||||||
|
this.teacher = json.teacher
|
||||||
|
this.level = json.level;
|
||||||
|
|
||||||
|
this.uniqueName = CourseInfo.toUniqueName(this.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user