summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-01 13:13:15 -0400
committerAndrew Cady <d@jerkface.net>2022-11-01 13:13:15 -0400
commitbc44295deb3e099ddefa8d0e7f067532d6b9a8ba (patch)
tree9a1a82cf6b3d4679b14fe0d8c166dedec6afd78b
parent2ae1c7299c67be911058692be3a645bb02067934 (diff)
fixup! show plate counts; empty fields for date, time, bodyweight
-rwxr-xr-xrepgoal.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/repgoal.hs b/repgoal.hs
index dc5227e..bec0252 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -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
206showPlates (fromIntegral -> wt) = fromMaybe "unavailable" $ fmap (ourShow . reverse) $ showPlates' (wt - 45) ourPlates [] 206showPlates :: Integer -> String
207showPlates (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)