renamed visitorScore to awayScore

This commit is contained in:
Jonathan Lamothe 2019-08-22 03:10:22 -04:00
parent ff19cd9fb5
commit 2e6a0f5ba4
2 changed files with 11 additions and 11 deletions

View File

@ -39,7 +39,7 @@ module Mtlstats.Types (
-- ** GameState Lenses
gameType,
homeScore,
visitorScore,
awayScore,
-- ** Database Lenses
dbPlayers,
dbGoalies,
@ -105,9 +105,9 @@ data ProgState = ProgState
-- | The game state
data GameState = GameState
{ _gameType :: Maybe GameType
, _homeScore :: Maybe Int
, _visitorScore :: Maybe Int
{ _gameType :: Maybe GameType
, _homeScore :: Maybe Int
, _awayScore :: Maybe Int
} deriving (Eq, Show)
-- | The program mode
@ -311,9 +311,9 @@ newProgState = ProgState
-- | Constructor for a 'GameState'
newGameState :: GameState
newGameState = GameState
{ _gameType = Nothing
, _homeScore = Nothing
, _visitorScore = Nothing
{ _gameType = Nothing
, _homeScore = Nothing
, _awayScore = Nothing
}
-- | Constructor for a 'Database'
@ -380,7 +380,7 @@ teamPoints :: ProgState -> Maybe Int
teamPoints s = case s ^. progMode of
NewGame gs -> case gs ^. gameType of
Just HomeGame -> gs ^. homeScore
Just AwayGame -> gs ^. visitorScore
Just AwayGame -> gs ^. awayScore
Nothing -> Nothing
_ -> Nothing

View File

@ -63,9 +63,9 @@ teamPointsSpec :: Spec
teamPointsSpec = describe "teamPoints" $ do
let
m t = NewGame $ newGameState
& gameType .~ Just t
& homeScore .~ Just 1
& visitorScore .~ Just 2
& gameType .~ Just t
& homeScore .~ Just 1
& awayScore .~ Just 2
s t = newProgState
& progMode .~ m t