nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.
https://nusmods.com
MIT License
557 stars 270 forks source link

Fix for Mobile Google Calendar Odd/Even Week Imports #3684

Open onx001 opened 3 months ago

onx001 commented 3 months ago

Added interval checking for numeric week calculations as Google Calendar imports on mobile do not handle exclusions well.

Also fixed additional tutorials for odd/even weeks being added after Week 11/13.

Context

3679

.ics iCal exports have weird handling issues with even/odd weeks, namely extra lessons after the intended one and a lack of proper exclusion handling for mobile Google Calendar users.

Implementation

A simple interval calculator is implemented for the calculateNumericWeek function, and the count and interval fields are passed to the ics generator where previously they were missing and filled through exclusions.

Other Information

Current handling of edge case intervals that do not follow the regular pattern or that skip intervals might still have the bug for extra lessons. Needs further investigation.

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 27, 2024 0:09am
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 27, 2024 0:09am
vercel[bot] commented 3 months ago

@onx001 is attempting to deploy a commit to a Personal Account owned by @nusmodifications on Vercel.

@nusmodifications first needs to authorize it.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 53.71%. Comparing base (7334b07) to head (1576dd8).

:exclamation: Current head 1576dd8 differs from pull request most recent head ce67073. Consider uploading reports for the commit ce67073 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3684 +/- ## ========================================== + Coverage 53.62% 53.71% +0.09% ========================================== Files 272 272 Lines 5979 5991 +12 Branches 1428 1433 +5 ========================================== + Hits 3206 3218 +12 Misses 2773 2773 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ravern commented 2 months ago

Hi, just tested out this PR as well, and there seems to be another bug: events on odd weeks only show up before recess week, while events on event weeks only show up after recess week.

Here's the timetable I used and I've also attached the exact .ics file I used.

https://nusmods-website-zrekiv0gl-mods-bot.vercel.app/timetable/sem-2/share?ME2115=LAB:2G1,TUT:2G,LEC:1&ME2121=LAB:2G3,TUT:2N,LEC:1

nusmods_calendar.ics.zip