implemented gameWon
This commit is contained in:
1 parent
c15ad6a477
commit
7ee53ee8c1
2 files changed
+36
No files matched your search
@@ -93,6 +93,7 @@ module Mtlstats.Types (
|
||||
-- ** GameState Helpers
|
||||
teamScore,
|
||||
otherScore,
|
||||
gameWon,
|
||||
gameTied,
|
||||
-- ** Player Helpers
|
||||
pPoints
|
||||
@@ -488,6 +489,12 @@ otherScore s = case s ^. gameType of
|
||||
Just AwayGame -> s ^. homeScore
|
||||
Nothing -> Nothing
|
||||
|
||||
-- | Checks if the game was won (returns 'False' if unknown)
|
||||
gameWon :: GameState -> Bool
|
||||
gameWon gs = case (,) <$> teamScore gs <*> otherScore gs of
|
||||
Just (team, other) -> team > other
|
||||
Nothing -> False
|
||||
|
||||
-- | Checks if the game has tied (retuns 'False' if unknown)
|
||||
gameTied :: GameState -> Bool
|
||||
gameTied gs = case (,) <$> gs^.homeScore <*> gs^.awayScore of
|
||||
|
||||
Reference in new issue
Block a user