mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf/pull/3832
Author: @daneroo
Created: 1/13/2025
Status: ✅ Merged
Merged: 1/15/2025
Merged by: @advplyr
Base:
master← Head:fix_rounding_elapsedPrettyExtended📝 Commits (1)
acda776Fixes [PR #2877] [MERGED] add iTunes podcast regions for all ABS supported languages (#3817)📊 Changes
2 files changed (+198 additions, -5 deletions)
View changed files
➕
client/cypress/tests/utils/ElapsedPrettyExtended.cy.js(+188 -0)📝
client/plugins/utils.js(+10 -5)📄 Description
Correct rounding and carry of minutes in client/plugins/utils.js:: Vue.prototype.$elapsedPrettyExtended
-Add cypress tests for Vue.prototype.$elapsedPrettyExtended function
Note: This is my first PR to the project, any feedback would be appreciated.
Brief summary
In the Audiobookshelf Year In Review, there was a time at which the App reported
"Listening Time" as "44d23h60m", but it should have been "Listening Time" as "45d"
Which issue is fixed?
Fixes #3817
In-depth Description
In client/plugins/utils.js:: Vue.prototype.$elapsedPrettyExtended,
specifically when showSeconds=false, the code to round minutes up (when seconds>=30) did not account for the carry of minutes into hours.
The solution was to add a condition that if the rounded up minutes were now>=60, we should carry minutes into hours.
Furthermore, this rounding condition was moved up in the function, before the conditional days handling, to prevent this carry condition from needing to be propagated to days as well.
How have you tested this?
I have added cypress tests (although these are pure functional/non-UI tests) to validate the current behavior of the
$elapsedPrettyExtendedfunction.Given that the current (existing) cypress tests are not all passing, and do not seem to be run in any GitHub Action CI tasks,
this is how you can run only the newly contributed tests:
Test Results
I also ran a brute force test (not submitted) to guarantee that the corrected function did not change the function's behaviour for cases other than those identified in this bug fix. i.e. I compared the value of the original function vs the fixed version for all values of 'seconds' in
[0s, 101 days]in increments of0.5secondsScreenshots
None
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.