summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-21 11:20:07 -0500
committerAndrew Cady <d@jerkface.net>2022-11-21 11:20:07 -0500
commitce5f3f7ff59f7d9d674ad54bde3ed4f315c8b93f (patch)
treea08b26d7bfbae13550ecd97f5b5e2cdc318a0a2e
parent2262dd62bc007c2ee9485ed9af248eba305fe051 (diff)
cleanups
-rwxr-xr-xrepgoal.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/repgoal.hs b/repgoal.hs
index f11dc84..e801afb 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -175,14 +175,14 @@ lookup' :: Int -> NESeq a -> a
175lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq 175lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq
176 176
177liftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]] 177liftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]]
178-- liftRows week lift = filter (not . null) $ (flip map) (annotatePosition $ liftScheme Fresher week) $ liftRow lift 178liftRows week (Lift _name Wendler, Just liftRecord) =
179liftRows week (Lift _name Wendler, Just liftRecord) = (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord 179 (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord
180liftRows _ (Lift name (Accessory sets reps), _) = (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps 180liftRows _ (Lift name (Accessory sets reps), _) =
181liftRows _ (Lift name Unspecified, _) = [unspecifiedLiftRow name] 181 (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps
182 182liftRows _ (Lift name Unspecified, _) =
183-- liftRow :: (Lift, Maybe LiftRecord) -> (ListPosition, SetScheme) -> [Widget n] 183 [unspecifiedLiftRow name]
184-- liftRow (_, Nothing) _ = [] 184
185-- liftRow (Lift _name Wendler, Just x) y = wendlerLiftRow x y 185accessoryLiftRow :: Text -> Int -> (ListPosition, Int) -> [Widget n]
186accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [ 186accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [
187 txt $ case position of FirstInList -> name; NotFirstInList -> " ", 187 txt $ case position of FirstInList -> name; NotFirstInList -> " ",
188 str $ printf "%2d @ %5s" targetReps (" " :: String), 188 str $ printf "%2d @ %5s" targetReps (" " :: String),
@@ -191,6 +191,7 @@ accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [
191 txt " ", 191 txt " ",
192 txt " " 192 txt " "
193 ] 193 ]
194unspecifiedLiftRow :: Text -> [Widget n]
194unspecifiedLiftRow name = map (padLeftRight 2) [ 195unspecifiedLiftRow name = map (padLeftRight 2) [
195 txt name, 196 txt name,
196 txt " ", 197 txt " ",
@@ -200,6 +201,7 @@ unspecifiedLiftRow name = map (padLeftRight 2) [
200 txt " " 201 txt " "
201 ] 202 ]
202 203
204wendlerLiftRow :: LiftRecord -> (ListPosition, SetScheme) -> [Widget n]
203wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap)) = 205wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap)) =
204 let best = bestPerformance stats 206 let best = bestPerformance stats
205 computedTarget = targetRatio * (90 % 100) * computeOneRepMax best 207 computedTarget = targetRatio * (90 % 100) * computeOneRepMax best