Skip to content

Fix ICS export section matching for non-sequential section numbers#132

Open
devin-ai-integration[bot] wants to merge 1 commit intoagentfrom
devin/1773258540-fix-ics-section-matching
Open

Fix ICS export section matching for non-sequential section numbers#132
devin-ai-integration[bot] wants to merge 1 commit intoagentfrom
devin/1773258540-fix-ics-section-matching

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Mar 11, 2026

Fix ICS export section matching for non-sequential section numbers

Summary

The ICS export used section.number - 1 === course.sectionId to find the selected section. This assumes section numbers are sequential and 1-indexed, but many Caltech courses have gaps in their section numbers (e.g., [1, 2, 4, 5] — 35-55 affected courses per term). For those courses, the export silently produced zero events.

The fix replaces the filter-by-number approach with direct array index access (course.courseData.sections[course.sectionId]), consistent with how the rest of the app resolves sections. Also adds a sectionId !== null guard in the outer filter.

Review & Testing Checklist for Human

  • Verify the fix by exporting an .ics file for a course with non-sequential section numbers (e.g., any research course like "Ae 200" or "Bi 22") and confirming events appear in your calendar app
  • Confirm existing ICS export still works for courses with sequential section numbers (e.g., "Ma 1 c", "Ph 1 c")
  • Spot-check that the sectionId !== null filter addition doesn't change behavior for courses with no section selected (previously these would pass the .enabled filter but produce no events from the inner filter — now they're excluded earlier)

Notes


Open with Devin

The ICS export used section.number - 1 === sectionId to match the
selected section, which assumes section numbers are sequential and
1-indexed. Many Caltech courses have gaps in section numbers (e.g.,
1, 2, 4, 5), causing the export to silently drop events for those
courses.

Fix by directly accessing the section via array index
(course.courseData.sections[sectionId]), consistent with how the rest
of the app resolves sections. Also adds a null-check for sectionId
and a test case exercising non-sequential section numbers.

Co-Authored-By: Rahul Chalamala <rahul@chalamala.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
caltech-dev a92e772 Commit Preview URL

Branch Preview URL
Mar 11 2026, 07:51 PM

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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