From 20dbe6c190366f2dc761ae11db06599821733c3c Mon Sep 17 00:00:00 2001 From: hanahmed05 Date: Wed, 8 Apr 2026 21:38:06 -0400 Subject: [PATCH 1/2] Add support for half-credit HASS-A classes --- scrapers/catalog.py | 2 +- scrapers/fireroad.py | 1 + scrapers/overrides.toml.d/override-schema.json | 5 +++++ scrapers/overrides.toml.d/sem/21h.toml | 3 +++ scrapers/package.py | 5 ++++- src/components/ActivityDescription.tsx | 8 +++++++- src/lib/raw.ts | 2 ++ 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/scrapers/catalog.py b/scrapers/catalog.py index f3ac0a4e..2003d322 100644 --- a/scrapers/catalog.py +++ b/scrapers/catalog.py @@ -239,7 +239,7 @@ def get_course_data(filtered_html: BeautifulSoup) -> dict[str, bool | int | str] "final": has_final(filtered_html), "half": get_half(filtered_html), "limited": is_limited(filtered_html), - "new": is_new(filtered_html), + "new": is_new(filtered_html) } diff --git a/scrapers/fireroad.py b/scrapers/fireroad.py index e7bb20a9..8e1dac80 100644 --- a/scrapers/fireroad.py +++ b/scrapers/fireroad.py @@ -437,6 +437,7 @@ def get_course_data( "name": course.get("title", ""), "inCharge": ",".join(course.get("instructors", [])), # type: ignore "virtualStatus": course.get("virtual_status", "") == "Virtual", + "is_half_class": course.get("is_half_class", False), } ) diff --git a/scrapers/overrides.toml.d/override-schema.json b/scrapers/overrides.toml.d/override-schema.json index 3aff4f74..c734f7a9 100644 --- a/scrapers/overrides.toml.d/override-schema.json +++ b/scrapers/overrides.toml.d/override-schema.json @@ -388,6 +388,11 @@ "title": "New", "description": "True if subject is new" }, + "is_half_class": { + "type": "boolean", + "title": "Half HASS-A", + "description": "True if class counts as half HASS-A" + }, "rating": { "type": "number", "title": "Rating", diff --git a/scrapers/overrides.toml.d/sem/21h.toml b/scrapers/overrides.toml.d/sem/21h.toml index f201e3dc..70335e04 100644 --- a/scrapers/overrides.toml.d/sem/21h.toml +++ b/scrapers/overrides.toml.d/sem/21h.toml @@ -15,3 +15,6 @@ inCharge = "I. Kumekawa" url = "https://history.mit.edu/subjects/special-subject-history-4/" hass = ["H"] new = true + +["21M.460"] +is_half_class = true \ No newline at end of file diff --git a/scrapers/package.py b/scrapers/package.py index 07cc45f8..a62758b6 100644 --- a/scrapers/package.py +++ b/scrapers/package.py @@ -151,7 +151,10 @@ def run() -> None: | get_include(overrides_all) | get_include(overrides_sem), ) - + for course_num, course in courses.items(): + if course_num.startswith("21M.1") or course_num.startswith("21M.4"): + course["is_half_class"] = True + term_info = get_term_info(sem) url_name = term_info["urlName"] diff --git a/src/components/ActivityDescription.tsx b/src/components/ActivityDescription.tsx index 3d74dff3..5c7b441b 100644 --- a/src/components/ActivityDescription.tsx +++ b/src/components/ActivityDescription.tsx @@ -1,5 +1,6 @@ import { useContext } from "react"; import { decode } from "html-entities"; +import { HASS } from "../lib/raw"; import { Flex, @@ -110,7 +111,12 @@ function ClassTypes(props: { cls: Class }) { ["phys2", "Physics 2"], ["rest", "REST"], ["hassH", "HASS-H"], - ["hassA", "HASS-A"], + [ + "hassA", + cls.rawClass.hass.includes(HASS.A) && cls.rawClass.is_half_class + ? "HASS-A (half)" + : "HASS-A", + ], ["hassS", "HASS-S"], ["hassE", "HASS-E"], ["cih", "CI-H"], diff --git a/src/lib/raw.ts b/src/lib/raw.ts index 9e7b3178..9424f7f9 100644 --- a/src/lib/raw.ts +++ b/src/lib/raw.ts @@ -10,6 +10,8 @@ export interface RawClass { subject: string; /** True if some section is not scheduled yet */ tba: boolean; + /** True if this counts as half of a HASS-A class */ + is_half_class?: boolean; /** Kinds of sections (among LECTURE, RECITATION, LAB, DESIGN) that exist */ sectionKinds: SectionKind[]; From a2c90037c78047a4890a6ca2f036f75b8f362aa2 Mon Sep 17 00:00:00 2001 From: Diego Temkin <65834932+dtemkin1@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:39:02 -0400 Subject: [PATCH 2/2] format, lint --- scrapers/catalog.py | 2 +- scrapers/package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapers/catalog.py b/scrapers/catalog.py index 2003d322..f3ac0a4e 100644 --- a/scrapers/catalog.py +++ b/scrapers/catalog.py @@ -239,7 +239,7 @@ def get_course_data(filtered_html: BeautifulSoup) -> dict[str, bool | int | str] "final": has_final(filtered_html), "half": get_half(filtered_html), "limited": is_limited(filtered_html), - "new": is_new(filtered_html) + "new": is_new(filtered_html), } diff --git a/scrapers/package.py b/scrapers/package.py index a62758b6..5330e937 100644 --- a/scrapers/package.py +++ b/scrapers/package.py @@ -154,7 +154,7 @@ def run() -> None: for course_num, course in courses.items(): if course_num.startswith("21M.1") or course_num.startswith("21M.4"): course["is_half_class"] = True - + term_info = get_term_info(sem) url_name = term_info["urlName"]