From 8b12d592a5244eed975edf55891c1ddb32c9ca82 Mon Sep 17 00:00:00 2001 From: Yudi Wu Date: Fri, 12 Jun 2026 18:36:25 +1000 Subject: [PATCH] fix: pass offerings to slotUsedWeight in semester-row so FY units aren't double-counted semester-row.tsx was the only call site of slotUsedWeight that omitted the offerings parameter. Without it, full-year units had their entire CP counted toward usedWeight in each semester (weight=2 for a 12cp unit instead of weight=1), causing the 'X / Y units' display to show incorrect numbers. Fixes #13 --- packages/webapp/components/planner/semester-row.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webapp/components/planner/semester-row.tsx b/packages/webapp/components/planner/semester-row.tsx index b8c7653..c5e2101 100644 --- a/packages/webapp/components/planner/semester-row.tsx +++ b/packages/webapp/components/planner/semester-row.tsx @@ -59,9 +59,9 @@ export function SemesterRow({ slot: PlannerSlot yearLabel: string }) { - const { dispatch, units } = usePlanner() + const { dispatch, units, offerings } = usePlanner() const capacity = slotCapacity(slot) - const usedWeight = slotUsedWeight(slot, units) + const usedWeight = slotUsedWeight(slot, units, offerings) const canDecrease = capacity > Math.max(1, usedWeight) const canIncrease = capacity < MAX_SLOT_CAPACITY const hasUnits = slot.unitCodes.length > 0