implemented gmsGames

This commit is contained in:
Jonathan Lamothe
2019-09-03 14:15:29 -04:00
parent 84cb2c8c19
commit 258cf59417
2 changed files with 25 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ module Mtlstats.Types (
gameLost,
gameTied,
-- ** GameStats Helpers
gmsGames,
gmsPoints,
addGameStats,
-- ** Player Helpers
@@ -541,6 +542,10 @@ gameLost gs = (<) <$> teamScore gs <*> otherScore gs
gameTied :: GameState -> Maybe Bool
gameTied gs = (==) <$> gs^.homeScore <*> gs^.awayScore
-- | Calculates the number of games played
gmsGames :: GameStats -> Int
gmsGames gs = gs^.gmsWins + gs^.gmsLosses
-- | Calculates the number of points
gmsPoints :: GameStats -> Int
gmsPoints gs = 2 * gs^.gmsWins + gs^. gmsOvertime