-
Notifications
You must be signed in to change notification settings - Fork 41
Fix Bug that makes hours visually "disappear" #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Once reaching 24hrs of time or 86400 seconds it would not display those 24hrs. My fix makes it show hours above 24 if there include_days is false and if it true it simplifies it into days aswell, and following the current formatting it hides the hours, if zero.
Removed 'workflow_dispatch' trigger from CI workflow.
Removed autocorrect option from rubocop linting step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where hours would "disappear" from the time display after exceeding 24 hours. The issue occurred when include_days was false - the function was calculating hours as a remainder after removing days (hours % 24), rather than showing total hours.
Key Changes:
- Modified hours calculation to show total hours when
include_daysis false, and hours within a day wheninclude_daysis true - Updated the condition for displaying hours to properly handle both modes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| end | ||
|
|
||
| def format_seconds(seconds, include_days: false) | ||
| def format_seconds(seconds, include_days = false) |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the parameter from a keyword argument (include_days:) to a positional argument (include_days =) breaks existing code. The codebase has multiple calls using the keyword argument syntax (e.g., format_seconds(data[:aho], include_days: true) in app/views/admin/fulfillment_dashboard/index.html.erb). These calls will fail with an ArgumentError after this change. Keep the keyword argument syntax to maintain backward compatibility.
| def format_seconds(seconds, include_days = false) | |
| def format_seconds(seconds, include_days = false, **kwargs) | |
| include_days = kwargs.fetch(:include_days, include_days) |
app/helpers/application_helper.rb
Outdated
| days = seconds / 86400 | ||
| hours = (seconds % 86400) / 3600 | ||
| hours = include_days ? (seconds % 86400) / 3600 : seconds / 3600 | ||
|
|
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line change doesn't serve a clear purpose and deviates from the original formatting. Consider keeping the original whitespace structure for consistency unless there's a specific style guide requirement.
app/helpers/application_helper.rb
Outdated
| minutes = (seconds % 3600) / 60 | ||
| secs = seconds % 60 | ||
|
|
||
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line change doesn't serve a clear purpose and deviates from the original formatting. Consider keeping the original whitespace structure for consistency unless there's a specific style guide requirement.
|
I like the time changes, but your PR touches a bunch of other stuff around CI runs. can you just cherrypick the change that should be made so i can merge that? |
Co-Authored-By: Acidicts <[email protected]>
|
I just moved this to #796! |
* Reapply #782 Co-Authored-By: Acidicts <[email protected]> * Add example usage of format_seconds --------- Co-authored-by: Acidicts <[email protected]>
I think it this bit
/app/helper/application_helper.rb
I'm presuming include_days is false which means hours is put only until it reaches 24hr
parts << "#{hours}h" if hours > 0 || (include_days && days > 0)where it should beparts << "#{hours}h" if hours > 0 || (! include_days && days > 0)My Version is: