implemented otherScore

This commit is contained in:
Jonathan Lamothe
2019-08-27 12:06:53 -04:00
parent 29459063c8
commit 97a42fd1de
2 changed files with 29 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ module Mtlstats.Types (
-- * Helper Functions
-- ** GameState Helpers
teamScore,
otherScore,
-- ** Player Helpers
pPoints
) where
@@ -511,6 +512,13 @@ teamScore s = case s ^. gameType of
Just AwayGame -> s ^. awayScore
Nothing -> Nothing
-- | Determines the other team's score
otherScore :: GameState -> Maybe Int
otherScore s = case s ^. gameType of
Just HomeGame -> s ^. awayScore
Just AwayGame -> s ^. homeScore
Nothing -> Nothing
-- | Calculates a player's points
pPoints :: PlayerStats -> Int
pPoints s = s^.psGoals + s^.psAssists