fix(optimiser): Prevent invalid time range
Context
On the optimiser page, time options for the dropdown lists are not filtered. This allows invalid time ranges to be selected, where the start time is after the end time, as shown below:
Start time 18:00 is after end time 14:00
Implementation
- I've abstracted the time ranges into constants, and stored the start/end times for class/lunch as state
- When start time is selected, we filter out end times to include options that are after start time
- This prevents users from selecting an invalid range where start time is after end time, as shown below:
Other Information
I've also added tests for the utility functions added
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nusmods-export | Preview | Comment | Aug 18, 2025 0:06am | |
| nusmods-website | Preview | Comment | Aug 18, 2025 0:06am |
@sevensxyt is attempting to deploy a commit to the modsbot's projects Team on Vercel.
A member of the Team first needs to authorize it.
Codecov Report
:x: Patch coverage is 23.07692% with 20 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 52.91%. Comparing base (988c6fd) to head (94ea529).
:warning: Report is 137 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| website/src/views/optimiser/OptimiserForm.tsx | 0.00% | 20 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #4113 +/- ##
==========================================
- Coverage 54.52% 52.91% -1.62%
==========================================
Files 274 289 +15
Lines 6076 6696 +620
Branches 1455 1633 +178
==========================================
+ Hits 3313 3543 +230
- Misses 2763 3153 +390
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Hi @sevensxyt, thanks for the PR. I'm currently working on a refactor of the optimiser component in #4094, and it also modifies the time select. I'll update you again when those changes are ready.
Hi @sevensxyt, #4094 has been merged.
Let me know if you are still interested in working on this. Thanks for your patience and sorry for the delay!