Repository navigation
Change playtime formatting to use total hours - #4884
Conversation
Previously, playtime exceeding 24 hours was formatted as days and hours (e.g., 2d 00h). This changes the formatting to use total accumulated hours (e.g., 48h 00m), which is more standard and intuitive for playtime tracking. Minutes are now always displayed, even when zero, to maintain consistency.
mirkobrombin
left a comment
There was a problem hiding this comment.
The total-hours format is fine. Please update test_format_playtime in bottles/tests/frontend/test_playtime_service.py, which still expects 1d/2d output, and the format_playtime docstring examples. The changed behavior should pass the existing suite with the new expectations.
|
Updated test_format_playtime expectations to 24h 00m / 25h 00m / 50h 00m, and added 24h 01m / 50h 02m cases to match equivalent existing lines for minutes and as a guard against days-format regression. Refreshed the format_playtime docstring to reflect the total-hours format (>= 3600s: "Hh MMm", no days). All 5 tests in test_playtime_service.py pass. Ready for re-review. Checked why CI is not passing and it seems unrelated to my changes. |
mirkobrombin
left a comment
There was a problem hiding this comment.
The tests and docstring now match the total-hours format. All five playtime frontend tests pass.
Note
CI fails on actions/checkout due to the missing submodule URL — this looks pre-existing and unrelated to my changes.
Closes: #4883
Type of change
Description
This PR updates the playtime formatting to use total accumulated hours instead of days.
Previously, playtime over 24 hours was shown as
2d 00h. Now it is shown as48h 00m. Minutes are always displayed, even when zero (e.g.,5h 00m).Motivation
Day-based formatting is uncommon and unintuitive for playtime tracking in gaming platforms. Using total hours is more intuitive and matches the standard set by platforms like Steam.
And this situation is possible, which gets a user confused:
Days are easily mixed up with hours.
Changes
format_playtimeinbottles/frontend/utils/playtime.py.Testing
sqlite3 process_metrics.sqliteso they show representative values and demostrate everything works.48h 00mis displayed instead of2d 00h.5h 00m).Before/After
After:
Before:
"View playtime statistics" window
Generative AI assistance
AI assistance: trivial