Skip to content

fix: raise course picker limit from 300 to 500 to prevent truncation#16

Open
coldfinity wants to merge 1 commit into
monashcoding:mainfrom
coldfinity:fix/course-picker-limit
Open

fix: raise course picker limit from 300 to 500 to prevent truncation#16
coldfinity wants to merge 1 commit into
monashcoding:mainfrom
coldfinity:fix/course-picker-limit

Conversation

@coldfinity

Copy link
Copy Markdown
Contributor

Problem

The course picker dropdown was missing courses, C6004 (Master of Data Science), C6001 (Masters of Information Technology) etc. The dropdown appeared to stop partway through the alphabetically-sorted list.

Root cause

listCoursesForPicker applies WHERE credit_points > 0 ORDER BY title LIMIT 300. With 432 qualifying courses in the 2026 handbook, the LIMIT silently truncated 132 courses alphabetically past row 300.

Diagnostic queries run

-- How many courses pass the credit_points filter?
SELECT COUNT(*) FROM courses WHERE year = '2026' AND credit_points > 0;
-- Result: 432

-- Where does C6004 land alphabetically?
WITH sorted AS (
  SELECT code, title, ROW_NUMBER() OVER (ORDER BY title) AS rn
  FROM courses WHERE year = '2026' AND credit_points > 0
)
SELECT * FROM sorted WHERE code = 'C6004';
-- Result: row 310 — past the LIMIT 300 cutoff

-- Confirmed C6004 data is correct (not excluded by any other filter)
SELECT code, title, credit_points, year FROM courses WHERE code = 'C6004';
-- C6004 | Master of Data Science | 96 | 2026

Fix

Bumped the limit from 300 to 500 across all call sites, plus raised the default parameter:

File Change
lib/db/queries.ts default 50 → 500
app/actions.ts 300 → 500
app/page.tsx 300 → 500
app/courses/[code]/page.tsx 300 → 500
app/units/[code]/page.tsx 300 → 500
app/tree/page.tsx 300 → 500

500 was chosen to leave headroom. Can be modified to a suitable integer.

Testing

pnpm --filter webapp build
pnpm --filter webapp test

  1. Stopped dev server, applied the changes, restarted pnpm --filter webapp dev
  2. Opened the planner and clicked the course picker dropdown
  3. Type in C6001 or C6004
  4. Verified other previously-missing courses (alphabetically past row 300) were also present
  5. Checked all four pages that render the picker: /, /tree, /courses/*, /units/* — all populated correctly

How to verify

pnpm --filter webapp dev
  1. Open http://localhost:3000
  2. Click the Course picker on the right sidebar
  3. Type or scroll to C6004 "Master of Data Science" appears
  4. Confirm the full list extends past the old cutoff by checking courses alphabetically beyond "M" (e.g. any P, S, U-prefixed courses)
  5. Repeat on /tree, /courses/C6004, /units/ all render the same picker in their respective page shells

With 432 qualifying courses in the 2026 handbook, the previous LIMIT 300
silently truncated the alphabetically-sorted list. C6004 (Master of Data
Science) sat at row 310 and never appeared in any course picker dropdown.
All call sites now pass 500 to leave headroom for future handbook years.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant