From 405ca1c5c7beed32c1d616bfa896d3d676c50104 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Mon, 4 Nov 2019 05:58:39 -0500 Subject: [PATCH] don't hang on goalie selection --- src/Mtlstats/Actions/GoalieInput.hs | 9 ++++++--- test/Actions/GoalieInputSpec.hs | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Mtlstats/Actions/GoalieInput.hs b/src/Mtlstats/Actions/GoalieInput.hs index 4a9594e..17f92ec 100644 --- a/src/Mtlstats/Actions/GoalieInput.hs +++ b/src/Mtlstats/Actions/GoalieInput.hs @@ -99,7 +99,10 @@ setGameGoalie gid s = fromMaybe s $ do & gYtd %~ updateStats & gLifetime %~ updateStats + updateGameState gs = gs + & gameGoalieStats %~ updateMap gid newGoalieStats updateStats + & gameGoalieAssigned .~ True + Just $ s - & database.dbGoalies %~ modifyNth gid updateGoalie - & progMode.gameStateL.gameGoalieStats - %~ updateMap gid newGoalieStats updateStats + & database.dbGoalies %~ modifyNth gid updateGoalie + & progMode.gameStateL %~ updateGameState diff --git a/test/Actions/GoalieInputSpec.hs b/test/Actions/GoalieInputSpec.hs index dc2c9a8..4d9a0ae 100644 --- a/test/Actions/GoalieInputSpec.hs +++ b/test/Actions/GoalieInputSpec.hs @@ -245,7 +245,10 @@ setGameGoalieSpec = describe "setGameGoalie" $ let [ ( "game stats", game, goalieStats gWins gLosses gTies ) , ( "YTD stats", ytd, goalieStats ytdWins ytdLosses ytdTies ) , ( "lifetime stats", lifetime, goalieStats ltWins ltLosses ltTies ) - ]) + ] + + it "should set the gameGoalieAssigned flag" $ + progState^.progMode.gameStateL.gameGoalieAssigned `shouldBe` True) [ ( "checking Bob", 0, bobData ) , ( "checking Joe", 1, joeData ) ])