diff options
author | Andrew Cady <d@jerkface.net> | 2022-11-01 13:13:15 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2022-11-01 13:13:15 -0400 |
commit | bc44295deb3e099ddefa8d0e7f067532d6b9a8ba (patch) | |
tree | 9a1a82cf6b3d4679b14fe0d8c166dedec6afd78b | |
parent | 2ae1c7299c67be911058692be3a645bb02067934 (diff) |
fixup! show plate counts; empty fields for date, time, bodyweight
-rwxr-xr-x | repgoal.hs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -203,11 +203,13 @@ drawUI st = [vCenter $ vBox [hCenter $ hBox [header, oneRepMaxTable], withVScrol | |||
203 | txt $ if amrap then " \n " else " " | 203 | txt $ if amrap then " \n " else " " |
204 | ] | 204 | ] |
205 | 205 | ||
206 | showPlates (fromIntegral -> wt) = fromMaybe "unavailable" $ fmap (ourShow . reverse) $ showPlates' (wt - 45) ourPlates [] | 206 | showPlates :: Integer -> String |
207 | showPlates (fromIntegral -> wt) = fromMaybe " " $ fmap (ourShow . reverse) $ showPlates' (wt - 45) ourPlates [] | ||
207 | where | 208 | where |
208 | ourPlates = [45,45,25,25,10,10,10,5,5,2.5] | 209 | ourPlates = [45,45,25,25,10,10,10,5,5,2.5] |
209 | ourShow :: [Rational] -> String | 210 | ourShow :: [Rational] -> String |
210 | ourShow = concat . intersperse " " . map showRational' | 211 | ourShow = concat . intersperse " " . map showRational' |
212 | showPlates' 0 _ [] = Nothing | ||
211 | showPlates' 0 _ used = Just used | 213 | showPlates' 0 _ used = Just used |
212 | showPlates' need (have:avail) used | have * 2 > need = showPlates' need avail used | 214 | showPlates' need (have:avail) used | have * 2 > need = showPlates' need avail used |
213 | showPlates' need (have:avail) used = showPlates' (need - have * 2) avail (have:used) | 215 | showPlates' need (have:avail) used = showPlates' (need - have * 2) avail (have:used) |