diff options
-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) |