Fix Effort scale ignored on Today hero gauge (#45)#1
Open
digitalerdude wants to merge 2 commits into
Open
Conversation
The Today screen's Effort hero circle always showed the raw internal 0-100 value regardless of the Effort scale preference (Settings -> Units), so choosing the WHOOP 0-21 scale still displayed numbers like 47 instead of a 0-21 value. HeroScoreCell also hardcoded the vessel fill fraction to score/100. Convert the Effort score with UnitFormatter.effortValue(_:scale:) at the call site and give HeroScoreCell an optional maxValue (default 100, unaffected for Charge/Rest) so the vessel fill matches the displayed number on both scales.
main already shipped an equivalent (and more complete) fix for the same Effort-scale hero bug, adding decimal-place support and unrelated later fixes (ryanbr#74, #1013) to the same view. Take main's version of LiquidTodayView.swift wholesale since it fully supersedes this branch's change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
Convert the Effort score via the existing UnitFormatter.effortValue(_:scale:) at the call site, and give HeroScoreCell an optional maxValue (default 100, so Charge/Rest are unaffected) so the fill and the displayed number agree on both scales.
Fixes ryanbr#45.