prompt user for players who've scored goals

This commit is contained in:
Jonathan Lamothe 2019-09-19 06:12:02 -04:00
parent e80b7ec48c
commit a66be1a45e

View File

@ -44,16 +44,17 @@ dispatch s = case s^.progMode of
MainMenu -> mainMenuC MainMenu -> mainMenuC
NewSeason -> newSeasonC NewSeason -> newSeasonC
NewGame gs NewGame gs
| null $ gs^.gameYear -> gameYearC | null $ gs^.gameYear -> gameYearC
| null $ gs^.gameMonth -> gameMonthC | null $ gs^.gameMonth -> gameMonthC
| null $ gs^.gameDay -> gameDayC | null $ gs^.gameDay -> gameDayC
| null $ gs^.gameType -> gameTypeC | null $ gs^.gameType -> gameTypeC
| null $ gs^.otherTeam -> otherTeamC | null $ gs^.otherTeam -> otherTeamC
| null $ gs^.homeScore -> homeScoreC | null $ gs^.homeScore -> homeScoreC
| null $ gs^.awayScore -> awayScoreC | null $ gs^.awayScore -> awayScoreC
| null $ gs^.overtimeFlag -> overtimeFlagC | null $ gs^.overtimeFlag -> overtimeFlagC
| not $ gs^.dataVerified -> verifyDataC | not $ gs^.dataVerified -> verifyDataC
| otherwise -> reportC | fromJust (unaccountedPoints gs) -> recordGoalC
| otherwise -> reportC
CreatePlayer cps CreatePlayer cps
| null $ cps^.cpsNumber -> getPlayerNumC | null $ cps^.cpsNumber -> getPlayerNumC
| null $ cps^.cpsName -> getPlayerNameC | null $ cps^.cpsName -> getPlayerNameC
@ -181,6 +182,19 @@ verifyDataC = Controller
return True return True
} }
recordGoalC :: Controller
recordGoalC = Controller
{ drawController = \s -> let
game = s^.database.dbGames
goal = succ $ s^.progMode.gameStateL.pointsAccounted
in drawPrompt (recordGoalPrompt game goal) s
, handleController = \e -> do
game <- gets $ view $ database.dbGames
goal <- succ <$> gets (view $ progMode.gameStateL.pointsAccounted)
promptHandler (recordGoalPrompt game goal) e
return True
}
reportC :: Controller reportC :: Controller
reportC = Controller reportC = Controller
{ drawController = \s -> do { drawController = \s -> do