Skip to content

Conversation

zehata
Copy link
Contributor

@zehata zehata commented Sep 5, 2025

Implementation

  • The lesson index of a lesson is its index in the timetable in the API response.
  • Lesson configs are now saved as mapping of lesson types to arrays of lesson indices. Example:
{
    CS1010S: {
        Lecture: [53],
        Tutorial: [19],
        Recitation: [32],
    },
}
  • TA configs have been removed. TA modules are now saved as an array of module codes. ["CS1010S"]
  • TA lessons will use the same lesson config as non-TA modules. TA lessons can now be added and removed individually. Example:
{
    CS1010S: {
        Lecture: [53],
        Tutorial: [19],
        Recitation: [32, 33],
    },
}
  • When a TA module is changed back to non-TA, it will use the closest matching valid non-TA lesson config.
  • Current format classNo lesson configs and TA lesson configs will be migrated to the new lessonGroup format
  • Serialization format has been changed
Change Before After
(..., ...) denotes arrays of lesson indices ?CG1111A=LAB:03 ?CG1111A=LAB:(5,6)
; separates different lesson types ?CS1010S=LEC:1,TUT:1 ?CS1010S=LEC:(53);TUT:(41)
TA modules serialized similar to hidden ?CG1111A=LAB:03&ta=CG1111A(LAB:03) ?CG1111A=LAB:(5,6)&ta=CG1111A
  • Current share link serialization format will be deserialized into the new format
  • Optimiser has been updated to share links in the new lessonGroup format.

Resolves

All modules can now be set as TA modules.
Resolves #3929 and #3930 , from which this implementation came from

Before After

Issue with deserialization of TA module lesson configs with multiple lessons in a module, from #4214 (comment).

Before After

All lessons of a single classNo now show up, and are highlighted when one of them is hovered over. Provided that the module is not set as a TA mod. Resolves #4168.

Before After

TA module lessons can now be added and removed individually.
User request from: https://t.me/NUSMods/12508 (No issue opened, at least I can't find one)

Before After

Known issues

Array Index Stability

Using the index of an array comes with the inherent issue of stability. Furthermore, it may fail silently, since lessons of the same lesson type are typically placed next to each other in the timetable list in the API response. So the module lesson config may remain valid even after the module timetable had been updated.

An alternative is to serialize additional info as proposed in #3930 . It will make share links very long, because of the serialization of weeks information.

Personally I think the lessons provided by the faculties are stable enough, and they will most likely not add an additional class in the middle of the semester, so I think it will be better idea to create UI to inform users that the module info has changed if it changes, which can be done simply by hashing the module info during scraping.

Copy link

vercel bot commented Sep 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nusmods-export Ready Ready Preview Comment Sep 12, 2025 9:24pm
nusmods-website Ready Ready Preview Comment Sep 12, 2025 9:24pm

Copy link

vercel bot commented Sep 5, 2025

@zehata is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Sep 5, 2025

Codecov Report

❌ Patch coverage is 86.77130% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.38%. Comparing base (988c6fd) to head (e0d9ba3).
⚠️ Report is 142 commits behind head on master.

Files with missing lines Patch % Lines
website/src/views/timetable/TimetableContent.tsx 42.46% 42 Missing ⚠️
...site/src/views/timetable/TimetableModulesTable.tsx 14.28% 6 Missing ⚠️
website/src/views/tetris/board.ts 0.00% 3 Missing ⚠️
website/src/reducers/timetables.ts 94.11% 2 Missing ⚠️
website/src/utils/timetables.ts 99.06% 2 Missing ⚠️
website/src/actions/export.ts 0.00% 1 Missing ⚠️
...c/views/components/module-info/LessonTimetable.tsx 66.66% 1 Missing ⚠️
website/src/views/settings/previewTimetable.ts 0.00% 1 Missing ⚠️
website/src/views/timetable/TimetableContainer.tsx 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4225      +/-   ##
==========================================
- Coverage   54.52%   54.38%   -0.14%     
==========================================
  Files         274      289      +15     
  Lines        6076     6862     +786     
  Branches     1455     1675     +220     
==========================================
+ Hits         3313     3732     +419     
- Misses       2763     3130     +367     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zehata
Copy link
Contributor Author

zehata commented Sep 9, 2025

Changes from #4226 is only a bugfix. The delta from this PR will apply to the fixed master too.

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.

Only one class shows up when selecting Lab with multiple classes with same class number TA Mode doesn't work for some courses
1 participant