diff options
| -rw-r--r-- | src/models/PeerTeacher.ts | 7 | ||||
| -rw-r--r-- | src/util/parser.ts | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/models/PeerTeacher.ts b/src/models/PeerTeacher.ts index 054afbb..b129859 100644 --- a/src/models/PeerTeacher.ts +++ b/src/models/PeerTeacher.ts @@ -23,7 +23,7 @@ export default class PeerTeacher { labs: Set<number>; email: string; - constructor(id: number | string, firstname: string, lastname: string) { + constructor(id: number | string, firstname: string, lastname: string, email: string) { if (typeof id === "string") { id = parseInt(id, 10); } @@ -33,10 +33,11 @@ export default class PeerTeacher { this.lastname = lastname; this.events = []; this.labs = new Set(); + this.email = email; } - static fromJSON({ id, firstname, lastname, events, labs }: PeerTeacherSerializeInfo) { - const pt = new PeerTeacher(id, firstname, lastname); + static fromJSON({ id, firstname, lastname, events, labs, email }: PeerTeacherSerializeInfo) { + const pt = new PeerTeacher(id, firstname, lastname, email); pt.events = events.map(e => EventInfo.fromJSON(e)); pt.labs = new Set(labs); return pt; diff --git a/src/util/parser.ts b/src/util/parser.ts index 7e062e1..c466525 100644 --- a/src/util/parser.ts +++ b/src/util/parser.ts @@ -51,7 +51,8 @@ interface DatabaseFile { start: number, end: number }[], - labs: number[] + labs: number[], + email: string }[] } @@ -73,7 +74,9 @@ export function parsePTSchedule(schedule: string) { } const [, firstname, lastname, uin] = nameLine.match(namePattern) as RegExpMatchArray; - const peerTeacher = new PeerTeacher(uin, firstname, lastname); + // TODO email should be parsed from the student's file too I guess, or just end up changing the parser to use survey results for everything, then parse schedules separately. + const email = "undefined" + const peerTeacher = new PeerTeacher(uin, firstname, lastname, email); const events = lines .filter(line => line.match(eventPattern)) |
