implemented unaccountedPoints helper function

This commit is contained in:
Jonathan Lamothe
2019-09-14 00:42:04 -04:00
parent 926a125692
commit 2ff8cff1c8
2 changed files with 38 additions and 0 deletions

View File

@@ -114,6 +114,7 @@ module Mtlstats.Types (
gameWon,
gameLost,
gameTied,
unaccountedPoints,
-- ** GameStats Helpers
gmsGames,
gmsPoints,
@@ -609,6 +610,13 @@ gameLost gs = do
gameTied :: GameState -> Maybe Bool
gameTied gs = (==) <$> gs^.homeScore <*> gs^.awayScore
-- | Checks for unaccounted points
unaccountedPoints :: GameState -> Maybe Bool
unaccountedPoints gs = do
scored <- teamScore gs
let accounted = gs^.pointsAccounted
Just $ scored > accounted
-- | Calculates the number of games played
gmsGames :: GameStats -> Int
gmsGames gs = gs^.gmsWins + gs^.gmsLosses + gs^.gmsOvertime