reference goals and assists by index number, not names
This commit is contained in:
@@ -211,12 +211,7 @@ recordGoalPrompt
|
||||
recordGoalPrompt game goal = selectPlayerPrompt
|
||||
( "*** GAME " ++ padNum 2 game ++ " ***\n"
|
||||
++ "Who scored goal number " ++ show goal ++ "? "
|
||||
) $ \case
|
||||
Nothing -> return ()
|
||||
Just n -> nth n <$> gets (view $ database.dbPlayers)
|
||||
>>= maybe
|
||||
(return ())
|
||||
(\p -> modify $ progMode.gameStateL.goalBy .~ p^.pName)
|
||||
) $ modify . (progMode.gameStateL.goalBy .~)
|
||||
|
||||
-- | Prompts for a player who assisted the goal
|
||||
recordAssistPrompt
|
||||
@@ -233,14 +228,11 @@ recordAssistPrompt game goal assist = selectPlayerPrompt
|
||||
++ "Assist #" ++ show assist ++ ": "
|
||||
) $ \case
|
||||
Nothing -> modify recordGoalAssists
|
||||
Just n -> nth n <$> gets (view $ database.dbPlayers)
|
||||
>>= maybe
|
||||
(return ())
|
||||
(\p -> do
|
||||
modify $ progMode.gameStateL.assistsBy %~ (++[p^.pName])
|
||||
nAssists <- length <$> gets (view $ progMode.gameStateL.assistsBy)
|
||||
when (nAssists >= maxAssists) $
|
||||
modify recordGoalAssists)
|
||||
Just n -> do
|
||||
modify $ progMode.gameStateL.assistsBy %~ (++[n])
|
||||
nAssists <- length <$> gets (view $ progMode.gameStateL.assistsBy)
|
||||
when (nAssists >= maxAssists) $
|
||||
modify recordGoalAssists
|
||||
|
||||
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
||||
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
||||
|
||||
Reference in New Issue
Block a user