Skip to content

Conversation

sevensxyt
Copy link
Contributor

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:

image

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:
image

Other Information

I've also added tests for the utility functions added

image

Copy link

vercel bot commented Jul 20, 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 Aug 18, 2025 0:06am
nusmods-website Ready Ready Preview Comment Aug 18, 2025 0:06am

Copy link

vercel bot commented Jul 20, 2025

@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.

Copy link

codecov bot commented Jul 20, 2025

Codecov Report

❌ Patch coverage is 23.07692% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.91%. Comparing base (988c6fd) to head (94ea529).
⚠️ Report is 137 commits behind head on master.

Files with missing lines Patch % Lines
website/src/views/optimiser/OptimiserForm.tsx 0.00% 20 Missing ⚠️
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     

☔ 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.

@sevensxyt sevensxyt changed the title Optimiser/prevent invalid time range fix(optimiser): Prevent invalid time range Jul 20, 2025
@leslieyip02
Copy link
Member

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.

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.

2 participants