Skip to content

[Bugfix:Submission] Clamp timer progress#12567

Merged
bmcutler merged 4 commits into
Submitty:mainfrom
akshitaa011:bugfix/notebook-timer-clamp
Mar 22, 2026
Merged

[Bugfix:Submission] Clamp timer progress#12567
bmcutler merged 4 commits into
Submitty:mainfrom
akshitaa011:bugfix/notebook-timer-clamp

Conversation

@akshitaa011

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Fixes #10440

The timed notebook gradeable had two bugs:

  1. Timer showed wrong countdown when student starts late
  2. Progress bar width could exceed 100% causing UI glitches

What is the New Behavior?

  • allowedTime is now clamped to not exceed time remaining until deadline
  • Progress bar width clamped between 0% and 100%
  • No more horizontal scrollbar overflow

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Create a timed notebook gradeable (10 min limit)
  2. Set due date to less than 10 minutes from now
  3. Start the gradeable as a student
  4. Observe timer shows correct reduced time
  5. Observe progress bar stays within bounds

Automated Testing & Documentation

No existing automated tests cover this UI calculation.

Other information

No breaking changes. No database migrations required.

@codecov

codecov Bot commented Mar 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.66%. Comparing base (64774d8) to head (893b9d8).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12567      +/-   ##
============================================
- Coverage     21.66%   21.66%   -0.01%     
  Complexity     9638     9638              
============================================
  Files           268      268              
  Lines         36223    36224       +1     
  Branches        486      487       +1     
============================================
  Hits           7847     7847              
  Misses        27894    27894              
- Partials        482      483       +1     
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (-0.01%) ⬇️
migrator 100.00% <ø> (ø)
php 20.68% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Eli-J-Schwartz Eli-J-Schwartz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I performed a functionality review of this PR.

The "Your Time Remaining" line now correctly displays either the remaining time in the users attempt, or the remaining time before the gradable is due, whichever is lower. Even when the server time is forced to be incorrect, the progress bar doesn't overflow and cause UI problems.

Given that the "Your Time Remaining" line is always correct, I think we should remove the "Gradable Time Remaining" line. At best, it's redundant, and at worst, it makes the student think they have more time than they actually do.

Comment thread site/public/js/submission-page.js Outdated
}
percent_used = Math.min(1, Math.max(0, percent_used));
width = (percent_used * 95) + 5;
width = Math.min(100, Math.max(0, width));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this line redundant with the two previous lines?

Comment thread site/public/js/submission-page.js
Comment thread site/public/js/submission-page.js Outdated
let percent_used = 0;
if (allowedTime > 0 && startTime > 0) {
percent_used = ((Date.now() - startTime) / 1000 / 60) / allowedTime;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the point of wrapping the calculation in an if statement? Both allowedTime and startTime should always be above 0.

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Mar 13, 2026
@akshitaa011

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed review @Eli-J-Schwartz! I’ve addressed all three points:

  1. Removed the redundant width = Math.min(100, Math.max(0, width)) line
  2. Simplified the deadline logic to clamp user_deadline as suggested
  3. Removed the conditional wrapper around the percent_used calculation

Please let me know if any further changes are needed. Thanks again!

@Eli-J-Schwartz Eli-J-Schwartz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes are much more readable now. I tested the functionality, and everything still functions as intended. Based on my previous comment, I recommended a change that hides duplicate time remaining boxes.

Comment thread site/public/js/submission-page.js
@akshitaa011

Copy link
Copy Markdown
Contributor Author

Hi @Eli-J-Schwartz! I've implemented the change to hide the duplicate gradeable time remaining text using visibility: hidden, along with a null check for safety. Please let me know if anything else needs to be changed. Thank you!

@Eli-J-Schwartz Eli-J-Schwartz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local functionality testing works as intended, and the changed code looks good. The currently only tests are due to issues in main, not this PR.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Mar 16, 2026
@akshitaa011

Copy link
Copy Markdown
Contributor Author

Thank you so much @Eli-J-Schwartz for the thorough review and
testing! Really appreciate your time and patience!

@roye2
roye2 self-requested a review March 20, 2026 00:41
@automateprojectmangement automateprojectmangement Bot moved this from Awaiting Maintainer Review to In Review in Submitty Development Mar 20, 2026

@roye2 roye2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the code make sense to me and I was able to verify that the timer / timer bar were working as intended. This PR looks good!

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Mar 20, 2026
@bmcutler
bmcutler merged commit 8a23a63 into Submitty:main Mar 22, 2026
47 of 49 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Mar 22, 2026
@akshitaa011

Copy link
Copy Markdown
Contributor Author

Thank you so much @Eli-J-Schwartz, @roye2, and @bmcutler for
reviewing, testing, and merging this PR! I really appreciate
the detailed feedback — it helped me write much cleaner code.
Looking forward to contributing more!

IDzyre pushed a commit to IDzyre/Submitty that referenced this pull request Mar 22, 2026
### Why is this Change Important & Necessary?
Fixes Submitty#10440

The timed notebook gradeable had two bugs:
1. Timer showed wrong countdown when student starts late
2. Progress bar width could exceed 100% causing UI glitches

### What is the New Behavior?
- allowedTime is now clamped to not exceed time remaining until deadline
- Progress bar width clamped between 0% and 100%
- No more horizontal scrollbar overflow

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. Create a timed notebook gradeable (10 min limit)
2. Set due date to less than 10 minutes from now
3. Start the gradeable as a student
4. Observe timer shows correct reduced time
5. Observe progress bar stays within bounds

### Automated Testing & Documentation
No existing automated tests cover this UI calculation.

### Other information
No breaking changes. No database migrations required.
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Mar 25, 2026
### Why is this Change Important & Necessary?
Fixes Submitty#10440

The timed notebook gradeable had two bugs:
1. Timer showed wrong countdown when student starts late
2. Progress bar width could exceed 100% causing UI glitches

### What is the New Behavior?
- allowedTime is now clamped to not exceed time remaining until deadline
- Progress bar width clamped between 0% and 100%
- No more horizontal scrollbar overflow

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. Create a timed notebook gradeable (10 min limit)
2. Set due date to less than 10 minutes from now
3. Start the gradeable as a student
4. Observe timer shows correct reduced time
5. Observe progress bar stays within bounds

### Automated Testing & Documentation
No existing automated tests cover this UI calculation.

### Other information
No breaking changes. No database migrations required.
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Mar 29, 2026
### Why is this Change Important & Necessary?
Fixes Submitty#10440

The timed notebook gradeable had two bugs:
1. Timer showed wrong countdown when student starts late
2. Progress bar width could exceed 100% causing UI glitches

### What is the New Behavior?
- allowedTime is now clamped to not exceed time remaining until deadline
- Progress bar width clamped between 0% and 100%
- No more horizontal scrollbar overflow

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. Create a timed notebook gradeable (10 min limit)
2. Set due date to less than 10 minutes from now
3. Start the gradeable as a student
4. Observe timer shows correct reduced time
5. Observe progress bar stays within bounds

### Automated Testing & Documentation
No existing automated tests cover this UI calculation.

### Other information
No breaking changes. No database migrations required.
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Apr 14, 2026
### Why is this Change Important & Necessary?
Fixes Submitty#10440

The timed notebook gradeable had two bugs:
1. Timer showed wrong countdown when student starts late
2. Progress bar width could exceed 100% causing UI glitches

### What is the New Behavior?
- allowedTime is now clamped to not exceed time remaining until deadline
- Progress bar width clamped between 0% and 100%
- No more horizontal scrollbar overflow

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. Create a timed notebook gradeable (10 min limit)
2. Set due date to less than 10 minutes from now
3. Start the gradeable as a student
4. Observe timer shows correct reduced time
5. Observe progress bar stays within bounds

### Automated Testing & Documentation
No existing automated tests cover this UI calculation.

### Other information
No breaking changes. No database migrations required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Bugs with Timed Notebook Gradeable

4 participants