From f580c7e972e0c8aa80494d14e4fa3553acc1297c Mon Sep 17 00:00:00 2001 From: psvenk <45520974+psvenk@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:19:46 -0400 Subject: [PATCH 1/4] Show class names for study support Use the day of the week to determine the class corresponding to the study support block. --- public/js/clock.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/public/js/clock.js b/public/js/clock.js index c1646479..1d7c27e7 100755 --- a/public/js/clock.js +++ b/public/js/clock.js @@ -232,6 +232,28 @@ function get_period_name(default_name, day_of_week) { bs_day = document.getElementById("schedule_title").innerHTML .toLowerCase(); } + + if (default_name === "Study Support") { + // Number of period whose study support block is today + let block = 0; + switch (day_of_week) { + case 1: + case 2: + block = day_of_week; + break; + case 4: + case 5: + block = day_of_week - 1; + break; + } + for (const { name, period } of period_names[bs_day]) { + if (period.includes(block)) { + return name; + } + } + return default_name; + } + // period_names has class names now for (const { name, period } of period_names[bs_day]) { if (period === default_name) From 18d193a2b637bb15216eae555471cc891f1eeec6 Mon Sep 17 00:00:00 2001 From: TekTaxi Date: Thu, 18 Mar 2021 17:40:03 -0400 Subject: [PATCH 2/4] exclude classes that don't recieve grades from grades tab --- src/scrape.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scrape.ts b/src/scrape.ts index e6941f74..f18496e7 100644 --- a/src/scrape.ts +++ b/src/scrape.ts @@ -51,6 +51,10 @@ export async function get_student( if (!details.grades.has(quarter)) { return undefined; } + // exclude classes that don't recieve grades in Aspen + if (["Study Support", "Advisory", "Community Meeting", "PE Athletics", "PE 10-12 Wellness Elective"].includes(details.name)) { + return undefined; + } let categories: { [key: string]: string } = {}; for (const [cat, { weight} ] of details.categories) { From a44745716ae94ccae492cda821fdf18a554ea396 Mon Sep 17 00:00:00 2001 From: TekTaxi Date: Thu, 18 Mar 2021 17:46:53 -0400 Subject: [PATCH 3/4] fix code formatting --- src/scrape.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scrape.ts b/src/scrape.ts index f18496e7..62550980 100644 --- a/src/scrape.ts +++ b/src/scrape.ts @@ -52,7 +52,8 @@ export async function get_student( return undefined; } // exclude classes that don't recieve grades in Aspen - if (["Study Support", "Advisory", "Community Meeting", "PE Athletics", "PE 10-12 Wellness Elective"].includes(details.name)) { + if (["Study Support", "Advisory", "Community Meeting", "PE Athletics", + "PE 10-12 Wellness Elective"].includes(details.name)) { return undefined; } From 8a73fd69209d5210d6fcfeec4eda801ca6a6f18a Mon Sep 17 00:00:00 2001 From: psvenk <45520974+psvenk@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:48:24 -0400 Subject: [PATCH 4/4] Fix code formatting some more --- src/scrape.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scrape.ts b/src/scrape.ts index 62550980..a2e66011 100644 --- a/src/scrape.ts +++ b/src/scrape.ts @@ -52,8 +52,10 @@ export async function get_student( return undefined; } // exclude classes that don't recieve grades in Aspen - if (["Study Support", "Advisory", "Community Meeting", "PE Athletics", - "PE 10-12 Wellness Elective"].includes(details.name)) { + if ([ + "Study Support", "Advisory", "Community Meeting", "PE Athletics", + "PE 10-12 Wellness Elective", + ].includes(details.name)) { return undefined; }