Add course pages #29

Open
opened 2026-10-03 19:44:36 +00:00 by jalenluorion · 0 comments
Member

Goal
Give each course a page at /courses/[number] (for example /courses/15-122) that lists its lectures and recitations with meeting days, times, and rooms, plus an "Add to schedule" button.

What you'll learn
The same full-stack pattern as org pages, working with scraped Schedule of Classes data.

Resources

Where to start

  • api/app/models/models.py: Course has course_number stored without a dash ("15122"), course_name, semesters, and org_id. Each course is an Organization of type COURSE named like "15-122 Principles of Imperative Computation".
  • api/scraper/transforms/soc_events.py: how sections are stored. One Event per section (title "15122 A"), category LECTURE or RECITATION, and a RecurrenceRule whose by_day holds the meeting days.
  • Add GET /api/organizations/courses/<course_number>, marked @public, in api/app/api/organizations.py. Strip the dash, look up the Course, and return its sections from Event joined to RecurrenceRule, not from occurrences.
  • web/src/app/courses/[number]/page.tsx: new page.
  • web/src/app/components/ProfileSidebar.tsx, handleAddCourse: the existing add flow is addOrgToSchedule(currentScheduleId, orgId) followed by useUser().addOrganization(orgId). Reuse it.

Done when

  • /courses/15-122 and /courses/15122 both work and show the course name and each section's days, times, and location
  • "Add to schedule" adds the course to the current schedule and turns into "In your schedule" when it is already there
  • Unknown numbers show "Course not found"
  • A pytest covers the new route
  • Works in light and dark mode

Notes
Ignore GET /api/organizations/get_courses: it reads a JSON file that no longer exists (api/app/utils/course_data.py is marked obsolete). If the user has no schedule, reuse the empty-state message from the sidebar.

**Goal** Give each course a page at `/courses/[number]` (for example `/courses/15-122`) that lists its lectures and recitations with meeting days, times, and rooms, plus an "Add to schedule" button. **What you'll learn** The same full-stack pattern as org pages, working with scraped Schedule of Classes data. **Resources** - [Next.js dynamic routes](https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes) - [How recurrence rules (RRULE) work](https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html) **Where to start** - `api/app/models/models.py`: `Course` has `course_number` stored without a dash ("15122"), `course_name`, `semesters`, and `org_id`. Each course is an `Organization` of type `COURSE` named like "15-122 Principles of Imperative Computation". - `api/scraper/transforms/soc_events.py`: how sections are stored. One `Event` per section (title "15122 A"), category LECTURE or RECITATION, and a `RecurrenceRule` whose `by_day` holds the meeting days. - Add `GET /api/organizations/courses/<course_number>`, marked `@public`, in `api/app/api/organizations.py`. Strip the dash, look up the `Course`, and return its sections from `Event` joined to `RecurrenceRule`, not from occurrences. - `web/src/app/courses/[number]/page.tsx`: new page. - `web/src/app/components/ProfileSidebar.tsx`, `handleAddCourse`: the existing add flow is `addOrgToSchedule(currentScheduleId, orgId)` followed by `useUser().addOrganization(orgId)`. Reuse it. **Done when** - [ ] `/courses/15-122` and `/courses/15122` both work and show the course name and each section's days, times, and location - [ ] "Add to schedule" adds the course to the current schedule and turns into "In your schedule" when it is already there - [ ] Unknown numbers show "Course not found" - [ ] A pytest covers the new route - [ ] Works in light and dark mode **Notes** Ignore `GET /api/organizations/get_courses`: it reads a JSON file that no longer exists (`api/app/utils/course_data.py` is marked obsolete). If the user has no schedule, reuse the empty-state message from the sidebar.
jalenluorion added this to the Phase 2 milestone 2026-10-03 19:44:36 +00:00
jalenluorion added this to the CMUCal project 2026-10-03 19:45:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/cal#29
No description provided.