[Bugfix:Submission] Clamp timer progress#12567
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Eli-J-Schwartz
left a comment
There was a problem hiding this comment.
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.
| } | ||
| percent_used = Math.min(1, Math.max(0, percent_used)); | ||
| width = (percent_used * 95) + 5; | ||
| width = Math.min(100, Math.max(0, width)); |
There was a problem hiding this comment.
Isn't this line redundant with the two previous lines?
| let percent_used = 0; | ||
| if (allowedTime > 0 && startTime > 0) { | ||
| percent_used = ((Date.now() - startTime) / 1000 / 60) / allowedTime; | ||
| } |
There was a problem hiding this comment.
Whats the point of wrapping the calculation in an if statement? Both allowedTime and startTime should always be above 0.
|
Thank you for the detailed review @Eli-J-Schwartz! I’ve addressed all three points:
Please let me know if any further changes are needed. Thanks again! |
Eli-J-Schwartz
left a comment
There was a problem hiding this comment.
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.
|
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
left a comment
There was a problem hiding this comment.
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.
|
Thank you so much @Eli-J-Schwartz for the thorough review and |
roye2
left a comment
There was a problem hiding this comment.
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!
|
Thank you so much @Eli-J-Schwartz, @roye2, and @bmcutler for |
### 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.
### 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.
### 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.
### 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.
Why is this Change Important & Necessary?
Fixes #10440
The timed notebook gradeable had two bugs:
What is the New Behavior?
What steps should a reviewer take to reproduce or test the bug or new feature?
Automated Testing & Documentation
No existing automated tests cover this UI calculation.
Other information
No breaking changes. No database migrations required.