diff options
author | Andrew Cady <d@jerkface.net> | 2022-11-04 01:07:38 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2022-11-04 01:08:00 -0400 |
commit | 74c86994c5c5f0b04261d015900664e128326994 (patch) | |
tree | 6341c6914f5f7026b2b28ceb921afb906d284838 | |
parent | 980cd96a41b8b030f849e9d31d18988e6260b3a7 (diff) |
accessories output achieved
needs cleanup, but committing because it works
-rwxr-xr-x | repgoal.hs | 36 |
1 files changed, 29 insertions, 7 deletions
@@ -173,11 +173,33 @@ annotatePosition (x:xs) = (FirstInList, x) : map (NotFirstInList,) xs | |||
173 | lookup' :: Int -> NESeq a -> a | 173 | lookup' :: Int -> NESeq a -> a |
174 | lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq | 174 | lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq |
175 | 175 | ||
176 | wendlerLiftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]] | 176 | liftRows :: WeekSelection -> (Lift, Maybe LiftRecord) -> [[Widget n]] |
177 | wendlerLiftRows 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 |
178 | wendlerLiftRow :: (Lift, Maybe LiftRecord) -> (ListPosition, SetScheme) -> [Widget n] | 178 | liftRows week (Lift _name Wendler, Just liftRecord) = (flip map) (annotatePosition $ liftScheme Fresher week) $ wendlerLiftRow liftRecord |
179 | wendlerLiftRow (_, Nothing) _ = [] | 179 | liftRows _ (Lift name (Accessory sets reps), _) = (flip map) (annotatePosition $ take sets $ repeat reps) $ accessoryLiftRow name reps |
180 | wendlerLiftRow (_, Just LiftRecord{..}) (position, (SetScheme targetRatio targetReps amrap)) = | 180 | liftRows _ (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 | ||
185 | accessoryLiftRow 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 | ] | ||
193 | unspecifiedLiftRow name = map (padLeftRight 2) [ | ||
194 | txt name, | ||
195 | txt " ", | ||
196 | txt " ", | ||
197 | txt " ", | ||
198 | txt " ", | ||
199 | txt " " | ||
200 | ] | ||
201 | |||
202 | wendlerLiftRow 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 [ |