nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

Add well-formed timetable validation check

Open leslieyip02 opened this issue 1 year ago • 3 comments

Context

Resolves #3673

Implementation

Added logic to check if a given timetable is well-formed:

  • Add lesson clash check
  • Add exam clash check

Other Information

One thing I wasn't sure about is this part in export.ts where the URL is hard coded:

https://github.com/nusmodifications/nusmods/blob/7334b074fc4fee253592418b28528784129c0f3d/website/src/apis/export.ts#L12

For local testing, I changed this to a local host manually, but I think this should be put into an environment variable?

Also, let me know if I should add any additional checks. I'm new to this so let me know if there's anything I missed!

leslieyip02 avatar Mar 31 '24 03:03 leslieyip02

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 Apr 15, 2024 8:37am
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 8:37am

vercel[bot] avatar Mar 31 '24 03:03 vercel[bot]

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

@nusmodifications first needs to authorize it.

vercel[bot] avatar Mar 31 '24 03:03 vercel[bot]

Codecov Report

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

Project coverage is 53.59%. Comparing base (2f723c6) to head (9e06b93). Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3700      +/-   ##
==========================================
- Coverage   53.61%   53.59%   -0.02%     
==========================================
  Files         272      272              
  Lines        5974     5974              
  Branches     1426     1426              
==========================================
- Hits         3203     3202       -1     
- Misses       2771     2772       +1     

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

codecov[bot] avatar Mar 31 '24 03:03 codecov[bot]

Hey @leslieyip02, thanks for the PR -- it's cool to see that you managed to identify the relevant code to look for timetable / exam clashes and stuff. However, I think I provided too little detail in my original issue about what "well-formed" entails -- I meant that we should write a basic check that the implicit conversion of data to PageData worked (and something like the fact that timetable is indeed a map from moduleCode to ModuleLessonConfig).

I'm not super sure about whether we should block the exporting of a timetable of there are lesson/exam clashes right now, especially since there isn't an option to customise timetable slots yet. We could discuss this in a new issue though (maybe a warning when exporting might be useful? idk)

kokrui avatar Apr 14 '24 10:04 kokrui

Oh I see. I think I will create a new PR in that case.

leslieyip02 avatar Apr 15 '24 08:04 leslieyip02