diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Labs.svelte | 23 | ||||
| -rw-r--r-- | src/models/Lab.ts | 23 | ||||
| -rw-r--r-- | src/models/PeerTeacher.ts | 2 | ||||
| -rw-r--r-- | src/util/parser.ts | 27 |
4 files changed, 58 insertions, 17 deletions
diff --git a/src/components/Labs.svelte b/src/components/Labs.svelte index 9f6e781..4df2184 100644 --- a/src/components/Labs.svelte +++ b/src/components/Labs.svelte @@ -7,7 +7,16 @@ $: labs = [...$labStore.values()].sort((a, b) => a.id - b.id); - let headers = ["", "Course", "Sec", "Time", "Location", "Assigned PT", ""]; + let headers = [ + "", + "Course", + "Sec", + "Time", + "Location", + "Instructor", + "Assigned PT", + "", + ]; $: pts = [...$ptStore.values()]; @@ -23,6 +32,17 @@ ]; }); + function displayFaculty(lab: Lab): string { + if (lab.faculty.length > 0) { + let s: string[] = []; + lab.faculty.forEach((f) => { + s.push(f.displayName); + }); + return s.join(","); + } else { + return "N/A"; + } + } function download() { // prepare data in CSV format let cols = headers.slice(1, -1); @@ -78,6 +98,7 @@ <th>{l.lab?.section}</th> <th>{l.lab?.time}</th> <th>{l.lab?.location}</th> + <th>{displayFaculty(l.lab)}</th> <th>{l.pt?.name ?? "UNASSIGNED"}</th> <th><button class="btn btn-ghost btn-xs">Delete</button></th> </tr> diff --git a/src/models/Lab.ts b/src/models/Lab.ts index 875bc7d..c3e21bb 100644 --- a/src/models/Lab.ts +++ b/src/models/Lab.ts @@ -11,7 +11,14 @@ interface LabSerializeInfo { }, building: string, room: string, - assigned: boolean + assigned: boolean, + faculty: { + bannerId: string, + courseReferenceNumber: string, + displayName: string, + emailAddress: string, + + }[] } export default class Lab { @@ -22,8 +29,15 @@ export default class Lab { building: string; room: string; assigned: boolean; + faculty: { + bannerId: string; + courseReferenceNumber: string; + displayName: string; + emailAddress: string; + + }[] - constructor(course: number | string, section: number | string, event: EventInfo, building = "", room = "", assigned = false) { + constructor(course: number | string, section: number | string, event: EventInfo, building = "", room = "", assigned = false, faculty = []) { if (typeof course === "string") { course = parseInt(course, 10); } @@ -38,10 +52,11 @@ export default class Lab { this.building = building; this.room = room; this.assigned = assigned; + this.faculty = faculty; } - static fromJSON({ course, section, event, building, room, assigned }: LabSerializeInfo) { - return new Lab(course, section, EventInfo.fromJSON(event), building, room, assigned); + static fromJSON({ course, section, event, building, room, assigned, faculty }: LabSerializeInfo) { + return new Lab(course, section, EventInfo.fromJSON(event), building, room, assigned, faculty); } get time() { diff --git a/src/models/PeerTeacher.ts b/src/models/PeerTeacher.ts index 5f9cf3c..c19fbd2 100644 --- a/src/models/PeerTeacher.ts +++ b/src/models/PeerTeacher.ts @@ -95,7 +95,7 @@ export default class PeerTeacher { let total_hours = 0; this.labs.forEach((lab_id) => { - total_hours += all_labs.get(lab_id)!.pay_hours; + total_hours += all_labs.get(lab_id)?.pay_hours; }) return total_hours; diff --git a/src/util/parser.ts b/src/util/parser.ts index a51bf5f..891099d 100644 --- a/src/util/parser.ts +++ b/src/util/parser.ts @@ -4,12 +4,18 @@ import PeerTeacher from "../models/PeerTeacher"; import { labStore, ptStore } from "../stores"; import { PeerTeacherImportError } from "./error"; import { get } from "svelte/store" -import { attr } from "svelte/internal"; interface LabSchedule { data: { courseNumber: string, sequenceNumber: string, + faculty: { + bannerId: string, + courseReferenceNumber: string, + displayName: string, + emailAddress: string, + + }[], meetingsFaculty: { meetingTime: { beginTime: string | null, @@ -40,6 +46,13 @@ interface DatabaseFile { start: number, end: number }, + faculty: { + bannerId: string, + courseReferenceNumber: string, + displayName: string, + emailAddress: string, + + }[], building: string, room: string, assigned: boolean @@ -87,7 +100,7 @@ export function parsePTSchedule(schedule: string) { * @param schedule The course schedule object from Howdy * @returns An array of labs */ -export function parseLabSchedule(schedule: LabSchedule) { +export function parseLabSchedule(schedule: LabSchedule): Lab[] { const taughtCourses = ['110', '111', '120', '121', '206', '221', '312', '313', '315', '331']; const results: Lab[] = []; @@ -116,15 +129,7 @@ export function parseLabSchedule(schedule: LabSchedule) { const { courseNumber, sequenceNumber } = course; const { building, room } = meetingTime; - results.push( - new Lab( - courseNumber, - sequenceNumber, - new EventInfo(days, start, end), - building, - room - ) - ); + results.push(new Lab(courseNumber, sequenceNumber, new EventInfo(days, start, end), building, room, false, course.faculty)); } } |
