summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-25 21:43:04 -0500
committerAndrew Cady <d@jerkface.net>2022-11-25 21:43:04 -0500
commitcc5197bddef148e6a231f937639ea57018f8f0e7 (patch)
treea39ce548d7de95693e9741da1fa75262ce867d3f
parentf0d7fc27357d2bf660c3025e8e8ba971fcc85f33 (diff)
show intensity percentage
-rwxr-xr-xrepgoal.hs10
1 files 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
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
114showRational :: Rational -> String 114showFloatConcise :: Float -> String
115showRational n = printf format $ (realToFrac :: Rational -> Float) $ n 115showFloatConcise 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
119showRational :: Rational -> String
120showRational = showFloatConcise . realToFrac
121
119data WeekSelection = Week1 | Week2 | Week3 | Week4 deriving (Enum, Bounded, Show, Eq) 122data WeekSelection = Week1 | Week2 | Week3 | Week4 deriving (Enum, Bounded, Show, Eq)
120 123
121data Programming = Wendler | Accessory Int Int | Unspecified 124data 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 " ",