From cc5197bddef148e6a231f937639ea57018f8f0e7 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 25 Nov 2022 21:43:04 -0500 Subject: show intensity percentage --- repgoal.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/repgoal.hs b/repgoal.hs index e801afb..d27e72c 100755 --- a/repgoal.hs +++ b/repgoal.hs @@ -111,11 +111,14 @@ showRational' n = printf format $ (realToFrac :: Rational -> Float) $ n where format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.1f" -showRational :: Rational -> String -showRational n = printf format $ (realToFrac :: Rational -> Float) $ n +showFloatConcise :: Float -> String +showFloatConcise n = printf format n where format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f" +showRational :: Rational -> String +showRational = showFloatConcise . realToFrac + data WeekSelection = Week1 | Week2 | Week3 | Week4 deriving (Enum, Bounded, Show, Eq) data Programming = Wendler | Accessory Int Int | Unspecified @@ -210,11 +213,12 @@ wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap goalTo1RM g = computeOneRepMax $ Achieved g targetWeight showGoal g = printf "%2d @ %d ≈ 1 @ %s" g targetWeight (showRational (goalTo1RM g)) pad = padBottom (Pad $ if amrap then 1 else 0) + actualIntensity = fromRational $ 100 * computedTarget / computeOneRepMax best :: Float in map (padLeftRight 2) [ pad $ txt $ case position of FirstInList -> liftRecordName; NotFirstInList -> " ", - pad $ str $ printf "%2d%s @ %d" targetReps (if amrap then "+" else "" :: Text) targetWeight, + pad $ str $ printf "%2d%s @ %d (%s%%)" targetReps (if amrap then "+" else "" :: Text) targetWeight (showFloatConcise actualIntensity), pad $ str $ showPlates targetWeight, str $ if amrap then showGoal repGoal ++ "\n" ++ showGoal (repGoal + 1) else " ", pad $ txt " ", -- cgit v1.2.3