summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-04 01:07:38 -0400
committerAndrew Cady <d@jerkface.net>2022-11-04 01:08:00 -0400
commit74c86994c5c5f0b04261d015900664e128326994 (patch)
tree6341c6914f5f7026b2b28ceb921afb906d284838
parent980cd96a41b8b030f849e9d31d18988e6260b3a7 (diff)
accessories output achieved
needs cleanup, but committing because it works
-rwxr-xr-xrepgoal.hs36
1 files changed, 29 insertions, 7 deletions
diff --git a/repgoal.hs b/repgoal.hs
index 2f76432..28f4096 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -173,11 +173,33 @@ annotatePosition (x:xs) = (FirstInList, x) : map (NotFirstInList,) xs
173lookup' :: Int -> NESeq a -> a 173lookup' :: Int -> NESeq a -> a
174lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq 174lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq
175 175
176wendlerLiftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]] 176liftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]]
177wendlerLiftRows week lift = filter (not . null) $ (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow lift 177-- liftRows week lift = filter (not . null) $ (flip map) (annotatePosition $ liftScheme Fresher week) $ liftRow lift
178wendlerLiftRow :: (Lift, Maybe LiftRecord) -> (ListPosition, SetScheme) -> [Widget n] 178liftRows week (Lift _name Wendler, Just liftRecord) = (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord
179wendlerLiftRow (_, Nothing) _ = [] 179liftRows _ (Lift name (Accessory sets reps), _) = (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps
180wendlerLiftRow (_, Just LiftRecord{..}) (position, (SetScheme targetRatio targetReps amrap)) = 180liftRows _ (Lift name Unspecified, _) = [unspecifiedLiftRow name]
181
182-- liftRow :: (Lift, Maybe LiftRecord) -> (ListPosition, SetScheme) -> [Widget n]
183-- liftRow (_, Nothing) _ = []
184-- liftRow (Lift _name Wendler, Just x) y = wendlerLiftRow x y
185accessoryLiftRow name targetReps (position, _) = map (padLeftRight 2) [
186 txt $ case position of FirstInList -> name; NotFirstInList -> " ",
187 str $ printf "%2d @ %5s" targetReps (" " :: String),
188 txt " ",
189 txt " ",
190 txt " ",
191 txt " "
192 ]
193unspecifiedLiftRow name = map (padLeftRight 2) [
194 txt name,
195 txt " ",
196 txt " ",
197 txt " ",
198 txt " ",
199 txt " "
200 ]
201
202wendlerLiftRow LiftRecord{..} (position, (SetScheme targetRatio targetReps amrap)) =
181 let best = bestPerformance stats 203 let best = bestPerformance stats
182 computedTarget = targetRatio * (90 % 100) * computeOneRepMax best 204 computedTarget = targetRatio * (90 % 100) * computeOneRepMax best
183 targetWeight = ceilingN 5 computedTarget 205 targetWeight = ceilingN 5 computedTarget
@@ -209,7 +231,7 @@ drawUI st = [vCenter $ vBox [hCenter $ hBox [header, oneRepMaxTable], withVScrol
209 liftNames = session & sessionLifts & fmap liftName & toList 231 liftNames = session & sessionLifts & fmap liftName & toList
210 liftRecords :: [LiftRecord] 232 liftRecords :: [LiftRecord]
211 liftRecords = filter ((`elem` liftNames) . liftRecordName) (view lifts st) 233 liftRecords = filter ((`elem` liftNames) . liftRecordName) (view lifts st)
212 lastSetTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Set", "Plates", "Goal", "Done", "Rest"] : concatMap (wendlerLiftRows (view week st)) lifts' 234 lastSetTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Set", "Plates", "Goal", "Done", "Rest"] : concatMap (liftRows (view week st)) lifts'
213 header = renderTable $ table $ map (padLeftRight 1 . txt) 235 header = renderTable $ table $ map (padLeftRight 1 . txt)
214 ["Date", "Time", "Bodyweight", "Week", "Session"] 236 ["Date", "Time", "Bodyweight", "Week", "Session"]
215 : [ map (padLeftRight 2 . txt) [" ", " ", " ", weekNumber, sessionName session] ] 237 : [ map (padLeftRight 2 . txt) [" ", " ", " ", weekNumber, sessionName session] ]
@@ -297,7 +319,7 @@ program =
297 Session "Deadlift" (Lift "Deadlift" Wendler :<|| Seq.fromList [ 319 Session "Deadlift" (Lift "Deadlift" Wendler :<|| Seq.fromList [
298 Lift "Press" Wendler, 320 Lift "Press" Wendler,
299 Lift "Row" $ Accessory 5 10, 321 Lift "Row" $ Accessory 5 10,
300 Lift "Dip" $ Accessory 5 2, 322 Lift "Dip" $ Unspecified,
301 Lift "Good Morning" $ Accessory 3 10]) 323 Lift "Good Morning" $ Accessory 3 10])
302 :<|| 324 :<||
303 Seq.fromList [ 325 Seq.fromList [