refactored updateGameStats and validageGameDate
This commit is contained in:
parent
24f02b427e
commit
5b6ecc8c40
|
@ -77,9 +77,7 @@ overtimeCheck s
|
||||||
|
|
||||||
-- | Adjusts the game stats based on the results of the current game
|
-- | Adjusts the game stats based on the results of the current game
|
||||||
updateGameStats :: ProgState -> ProgState
|
updateGameStats :: ProgState -> ProgState
|
||||||
updateGameStats s = fromMaybe s result
|
updateGameStats s = fromMaybe s $ do
|
||||||
where
|
|
||||||
result = do
|
|
||||||
gType <- s^.progMode.gameStateL.gameType
|
gType <- s^.progMode.gameStateL.gameType
|
||||||
won <- gameWon $ s^.progMode.gameStateL
|
won <- gameWon $ s^.progMode.gameStateL
|
||||||
lost <- gameLost $ s^.progMode.gameStateL
|
lost <- gameLost $ s^.progMode.gameStateL
|
||||||
|
@ -103,9 +101,7 @@ updateGameStats s = fromMaybe s result
|
||||||
|
|
||||||
-- | Validates the game date
|
-- | Validates the game date
|
||||||
validateGameDate :: ProgState -> ProgState
|
validateGameDate :: ProgState -> ProgState
|
||||||
validateGameDate s = fromMaybe s result
|
validateGameDate s = fromMaybe s $ do
|
||||||
where
|
|
||||||
result = do
|
|
||||||
y <- toInteger <$> s^.progMode.gameStateL.gameYear
|
y <- toInteger <$> s^.progMode.gameStateL.gameYear
|
||||||
m <- s^.progMode.gameStateL.gameMonth
|
m <- s^.progMode.gameStateL.gameMonth
|
||||||
d <- s^.progMode.gameStateL.gameDay
|
d <- s^.progMode.gameStateL.gameDay
|
||||||
|
|
Loading…
Reference in New Issue
Block a user