From a4bd240abc1675ae22c431ed298a01ac6b231f53 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Tue, 16 Aug 2022 22:37:28 -0500 Subject: `feat`: Display PT's courses Add func to output a map of `courses_can_teach : assigned_labs[]` --- src/components/TamuOutput.svelte | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/components') diff --git a/src/components/TamuOutput.svelte b/src/components/TamuOutput.svelte index 2ce93e6..1d2d26d 100644 --- a/src/components/TamuOutput.svelte +++ b/src/components/TamuOutput.svelte @@ -7,25 +7,6 @@ ? a.firstname.toUpperCase().localeCompare(b.firstname.toUpperCase()) : a.lastname.toUpperCase().localeCompare(b.lastname.toUpperCase()) ); - - function getCourses(pt: PeerTeacher) { - const courses = new Map(); - const getCourse = (x: number) => Math.floor(x / 1000); - pt.labs.forEach((lab_id) => { - const key = getCourse(lab_id); - const sec = lab_id % 1000; - if (courses.has(key)) { - courses.get(key).push(sec); - } else { - courses.set(key, [sec]); - } - }); - pt.can_teach.forEach((course) => { - if (course == null || course == undefined) return; - if (!courses.has(course)) courses.set(course, []); - }); - return courses; - }
Courses:

    - {#each Array.from(getCourses(pt)) as lab} + {#each Array.from(pt.coursesAndLabs()) as lab}
  • CSCE {lab[0]} - {lab[1]}
  • -- cgit v1.2.3