implemented year-to-date report

This commit is contained in:
Jonathan Lamothe 2019-10-16 02:23:25 -04:00
parent bfe568492d
commit 32f61ccc89

View File

@ -41,6 +41,8 @@ report width s
= standingsReport width s
++ [""]
++ gameStatsReport width s
++ [""]
++ yearToDateStatsReport width s
standingsReport :: Int -> ProgState -> [String]
standingsReport width s = fromMaybe [] $ do
@ -96,6 +98,11 @@ gameStatsReport width s = maybe [] (playerReport width "GAME") $
Just (p, stats))
(M.toList $ s^.progMode.gameStateL.gamePlayerStats)
yearToDateStatsReport :: Int -> ProgState -> [String]
yearToDateStatsReport width s = playerReport width "YEAR TO DATE" $
map (\p -> (p, p^.pYtd)) $
filter playerIsActive $ s^.database.dbPlayers
gameDate :: GameState -> String
gameDate gs = fromMaybe "" $ do
year <- show <$> gs^.gameYear