implemented confirmCreateGoalieC

This commit is contained in:
Jonathan Lamothe 2019-10-25 01:07:04 -04:00
parent ed31ce5b1d
commit 2d2ee61aae
2 changed files with 25 additions and 1 deletions

View File

@ -33,6 +33,7 @@ module Mtlstats.Actions
, createPlayer
, createGoalie
, addPlayer
, addGoalie
, recordGoalAssists
, awardGoal
, awardAssist
@ -167,6 +168,10 @@ addPlayer s = fromMaybe s $ do
Just $ s & database.dbPlayers
%~ (++[player])
-- | Adds the entered goalie to the roster
addGoalie :: ProgState -> ProgState
addGoalie = undefined
-- | Awards the goal and assists to the players
recordGoalAssists :: ProgState -> ProgState
recordGoalAssists ps = fromMaybe ps $ do

View File

@ -357,7 +357,26 @@ getGoalieNameC = Controller
}
confirmCreateGoalieC :: Controller
confirmCreateGoalieC = undefined
confirmCreateGoalieC = Controller
{ drawController = \s -> do
let cgs = s^.progMode.createGoalieStateL
C.drawString $ unlines
[ "Goalie number: " ++ show (fromJust $ cgs^.cgsNumber)
, " Goalie name: " ++ cgs^.cgsName
, ""
, "Create goalie: are you sure? (Y/N)"
]
return C.CursorInvisible
, handleController = \e -> do
case ynHandler e of
Just True -> do
modify addGoalie
join $ gets (^.progMode.createGoalieStateL.cgsSuccessCallback)
Just False ->
join $ gets (^.progMode.createGoalieStateL.cgsFailureCallback)
Nothing -> return ()
return True
}
gameGoal :: ProgState -> (Int, Int)
gameGoal s =