From ce5f3f7ff59f7d9d674ad54bde3ed4f315c8b93f Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Mon, 21 Nov 2022 11:20:07 -0500 Subject: cleanups --- repgoal.hs | 18 ++++++++++-------- 1 file 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 lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq liftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]] --- liftRows week lift = filter (not . null) $ (flip map) (annotatePosition $ liftScheme Fresher week) $ liftRow lift -liftRows week (Lift _name Wendler, Just liftRecord) = (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord -liftRows _ (Lift name (Accessory sets reps), _) = (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps -liftRows _ (Lift name Unspecified, _) = [unspecifiedLiftRow name] - --- liftRow :: (Lift, Maybe LiftRecord) -> (ListPosition, SetScheme) -> [Widget n] --- liftRow (_, Nothing) _ = [] --- liftRow (Lift _name Wendler, Just x) y = wendlerLiftRow x y +liftRows week (Lift _name Wendler, Just liftRecord) = + (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord +liftRows _ (Lift name (Accessory sets reps), _) = + (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps +liftRows _ (Lift name Unspecified, _) = + [unspecifiedLiftRow name] + +accessoryLiftRow :: Text -> Int -> (ListPosition, Int) -> [Widget n] accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [ txt $ case position of FirstInList -> name; NotFirstInList -> " ", str $ printf "%2d @ %5s" targetReps (" " :: String), @@ -191,6 +191,7 @@ accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [ txt " ", txt " " ] +unspecifiedLiftRow :: Text -> [Widget n] unspecifiedLiftRow name = map (padLeftRight 2) [ txt name, txt " ", @@ -200,6 +201,7 @@ unspecifiedLiftRow name = map (padLeftRight 2) [ txt " " ] +wendlerLiftRow :: LiftRecord -> (ListPosition, SetScheme) -> [Widget n] wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap)) = let best = bestPerformance stats computedTarget = targetRatio * (90 % 100) * computeOneRepMax best -- cgit v1.2.3