From 32f61ccc89e0606f52ffc25128cc50c2cb51d829 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 16 Oct 2019 02:23:25 -0400 Subject: [PATCH] implemented year-to-date report --- src/Mtlstats/Report.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Mtlstats/Report.hs b/src/Mtlstats/Report.hs index 70683e8..17a5b8a 100644 --- a/src/Mtlstats/Report.hs +++ b/src/Mtlstats/Report.hs @@ -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