- 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
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { analyzeDecisionTree } from '../solver/decisionTree';
|
|
import type { OptimizationMode } from '../data/types';
|
|
import type { SetAnalysis } from '../solver/decisionTree';
|
|
|
|
export interface WorkerRequest {
|
|
pinnedCourseIds: string[];
|
|
openSetIds: string[];
|
|
ranking: string[];
|
|
mode: OptimizationMode;
|
|
excludedCourseIds?: string[];
|
|
}
|
|
|
|
export interface WorkerResponse {
|
|
type: 'setComplete' | 'allComplete';
|
|
analysis?: SetAnalysis;
|
|
analyses?: SetAnalysis[];
|
|
}
|
|
|
|
self.onmessage = (e: MessageEvent<WorkerRequest>) => {
|
|
const { pinnedCourseIds, openSetIds, ranking, mode, excludedCourseIds } = e.data;
|
|
const excludedSet = excludedCourseIds && excludedCourseIds.length > 0
|
|
? new Set(excludedCourseIds)
|
|
: undefined;
|
|
|
|
const analyses = analyzeDecisionTree(
|
|
pinnedCourseIds,
|
|
openSetIds,
|
|
ranking,
|
|
mode,
|
|
(analysis) => {
|
|
// Progressive update: send each set's results as they complete
|
|
const response: WorkerResponse = { type: 'setComplete', analysis };
|
|
self.postMessage(response);
|
|
},
|
|
excludedSet,
|
|
);
|
|
|
|
// Final result with sorted analyses
|
|
const response: WorkerResponse = { type: 'allComplete', analyses };
|
|
self.postMessage(response);
|
|
};
|