From 0b249bcdaebe51ff77a249061250285bf7a55e8e Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 9 Oct 2019 00:30:03 -0400 Subject: [PATCH] calculate and display total game stats --- src/Mtlstats/Report.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Mtlstats/Report.hs b/src/Mtlstats/Report.hs index 7f0d127..9c4212e 100644 --- a/src/Mtlstats/Report.hs +++ b/src/Mtlstats/Report.hs @@ -99,6 +99,7 @@ gameStatsReport width s = unlines $ fromMaybe [] $ do nameWidth = succ $ maximum $ 10 : map (length . (^.pName) . fst) pStats + tStats = foldr (addPlayerStats . snd) newPlayerStats pStats Just $ [ centre width "GAME STATISTICS" , "" @@ -118,7 +119,20 @@ gameStatsReport width s = unlines $ fromMaybe [] $ do ++ right 6 (show $ stats^.psAssists) ++ right 6 (show $ pPoints stats) ++ right 6 (show $ stats^.psPMin)) - pStats + pStats ++ + [ centre width + $ replicate (4 + nameWidth) ' ' + ++ replicate (3 + 3 * 6) '-' + , overlay + "GAME TOTALS" + ( centre width + $ replicate (4 + nameWidth) ' ' + ++ right 3 (show $ tStats^.psGoals) + ++ right 6 (show $ tStats^.psAssists) + ++ right 6 (show $ pPoints tStats) + ++ right 6 (show $ tStats^.psPMin) + ) + ] gameDate :: GameState -> String gameDate gs = fromMaybe "" $ do