implemented gameTied helper function
This commit is contained in:
1 parent
e834019fc9
commit
c15ad6a477
2 files changed
+25
No files matched your search
@@ -93,6 +93,7 @@ module Mtlstats.Types (
|
||||
-- ** GameState Helpers
|
||||
teamScore,
|
||||
otherScore,
|
||||
gameTied,
|
||||
-- ** Player Helpers
|
||||
pPoints
|
||||
) where
|
||||
@@ -487,6 +488,12 @@ otherScore s = case s ^. gameType of
|
||||
Just AwayGame -> s ^. homeScore
|
||||
Nothing -> Nothing
|
||||
|
||||
-- | Checks if the game has tied (retuns 'False' if unknown)
|
||||
gameTied :: GameState -> Bool
|
||||
gameTied gs = case (,) <$> gs^.homeScore <*> gs^.awayScore of
|
||||
Just (home, away) -> home == away
|
||||
Nothing -> False
|
||||
|
||||
-- | Calculates a player's points
|
||||
pPoints :: PlayerStats -> Int
|
||||
pPoints s = s^.psGoals + s^.psAssists
|
||||
Reference in new issue
Block a user