diff options
author | Andrew Cady <d@jerkface.net> | 2022-11-25 21:43:04 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2022-11-25 21:43:04 -0500 |
commit | cc5197bddef148e6a231f937639ea57018f8f0e7 (patch) | |
tree | a39ce548d7de95693e9741da1fa75262ce867d3f | |
parent | f0d7fc27357d2bf660c3025e8e8ba971fcc85f33 (diff) |
show intensity percentage
-rwxr-xr-x | repgoal.hs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -111,11 +111,14 @@ showRational' n = printf format $ (realToFrac :: Rational -> Float) $ n | |||
111 | where | 111 | where |
112 | format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.1f" | 112 | format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.1f" |
113 | 113 | ||
114 | showRational :: Rational -> String | 114 | showFloatConcise :: Float -> String |
115 | showRational n = printf format $ (realToFrac :: Rational -> Float) $ n | 115 | showFloatConcise n = printf format n |
116 | where | 116 | where |
117 | format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f" | 117 | format = if floor (n * 10) `mod` 10 == (0 :: Integer) then "%.0f" else "%.2f" |
118 | 118 | ||
119 | showRational :: Rational -> String | ||
120 | showRational = showFloatConcise . realToFrac | ||
121 | |||
119 | data WeekSelection = Week1 | Week2 | Week3 | Week4 deriving (Enum, Bounded, Show, Eq) | 122 | data WeekSelection = Week1 | Week2 | Week3 | Week4 deriving (Enum, Bounded, Show, Eq) |
120 | 123 | ||
121 | data Programming = Wendler | Accessory Int Int | Unspecified | 124 | data Programming = Wendler | Accessory Int Int | Unspecified |
@@ -210,11 +213,12 @@ wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap | |||
210 | goalTo1RM g = computeOneRepMax $ Achieved g targetWeight | 213 | goalTo1RM g = computeOneRepMax $ Achieved g targetWeight |
211 | showGoal g = printf "%2d @ %d ≈ 1 @ %s" g targetWeight (showRational (goalTo1RM g)) | 214 | showGoal g = printf "%2d @ %d ≈ 1 @ %s" g targetWeight (showRational (goalTo1RM g)) |
212 | pad = padBottom (Pad $ if amrap then 1 else 0) | 215 | pad = padBottom (Pad $ if amrap then 1 else 0) |
216 | actualIntensity = fromRational $ 100 * computedTarget / computeOneRepMax best :: Float | ||
213 | in | 217 | in |
214 | map (padLeftRight 2) | 218 | map (padLeftRight 2) |
215 | [ | 219 | [ |
216 | pad $ txt $ case position of FirstInList -> liftRecordName; NotFirstInList -> " ", | 220 | pad $ txt $ case position of FirstInList -> liftRecordName; NotFirstInList -> " ", |
217 | pad $ str $ printf "%2d%s @ %d" targetReps (if amrap then "+" else "" :: Text) targetWeight, | 221 | pad $ str $ printf "%2d%s @ %d (%s%%)" targetReps (if amrap then "+" else "" :: Text) targetWeight (showFloatConcise actualIntensity), |
218 | pad $ str $ showPlates targetWeight, | 222 | pad $ str $ showPlates targetWeight, |
219 | str $ if amrap then showGoal repGoal ++ "\n" ++ showGoal (repGoal + 1) else " ", | 223 | str $ if amrap then showGoal repGoal ++ "\n" ++ showGoal (repGoal + 1) else " ", |
220 | pad $ txt " ", | 224 | pad $ txt " ", |