Files
emba-course-solver/app/src/data/lookups.ts
T
Bill 8b887f7750 v1.1.0: Add cancelled course, duplicate prevention, and credit bar ticks
- Mark "Managing Growing Companies" as cancelled with visual indicator and solver exclusion
- Prevent selecting duplicate courses across elective sets (e.g., same course in Spring and Summer)
- Add 2.5-credit interval tick marks to specialization progress bars
- Bump version to 1.1.0 with date display in UI header
2026-03-13 16:11:56 -04:00

53 lines
1.6 KiB
TypeScript

import { COURSES } from './courses';
import { ELECTIVE_SETS } from './electiveSets';
import type { Course, Qualification } from './types';
// Courses indexed by set ID
export const coursesBySet: Record<string, Course[]> = {};
for (const set of ELECTIVE_SETS) {
coursesBySet[set.id] = set.courseIds.map(
(cid) => COURSES.find((c) => c.id === cid)!
);
}
// Qualifications indexed by course ID
export const qualificationsByCourse: Record<string, Qualification[]> = {};
for (const course of COURSES) {
qualificationsByCourse[course.id] = course.qualifications;
}
// Course IDs indexed by specialization ID (with marker info)
export const coursesBySpec: Record<string, { courseId: string; marker: Qualification['marker'] }[]> = {};
for (const course of COURSES) {
for (const q of course.qualifications) {
if (!coursesBySpec[q.specId]) {
coursesBySpec[q.specId] = [];
}
coursesBySpec[q.specId].push({ courseId: course.id, marker: q.marker });
}
}
// Course lookup by ID
export const courseById: Record<string, Course> = {};
for (const course of COURSES) {
courseById[course.id] = course;
}
// Set ID lookup by course ID
export const setIdByCourse: Record<string, string> = {};
for (const course of COURSES) {
setIdByCourse[course.id] = course.setId;
}
// Cancelled course IDs
export const cancelledCourseIds = new Set(
COURSES.filter((c) => c.cancelled).map((c) => c.id),
);
// Course IDs indexed by course name (for detecting duplicates across sets)
export const courseIdsByName: Record<string, string[]> = {};
for (const course of COURSES) {
if (course.cancelled) continue;
(courseIdsByName[course.name] ??= []).push(course.id);
}