implemented lifetime goals editing

This commit is contained in:
Jonathan Lamothe 2019-11-01 06:40:48 -04:00
parent c9b198d106
commit 9840e5a90e
2 changed files with 12 additions and 1 deletions

View File

@ -119,7 +119,12 @@ ytdPMinC = Controller
}
ltGoalsC :: Controller
ltGoalsC = undefined
ltGoalsC = Controller
{ drawController = drawPrompt editPlayerLtGoalsPrompt
, handleController = \e -> do
promptHandler editPlayerLtGoalsPrompt e
return True
}
ltAssistsC :: Controller
ltAssistsC = undefined

View File

@ -26,6 +26,7 @@ module Mtlstats.Prompt.EditPlayer
, editPlayerYtdGoalsPrompt
, editPlayerYtdAssistsPrompt
, editPlayerYtdPMinPrompt
, editPlayerLtGoalsPrompt
) where
import Control.Monad.Extra (whenJustM)
@ -66,6 +67,11 @@ editPlayerYtdPMinPrompt :: Prompt
editPlayerYtdPMinPrompt = numPrompt "Year-to-date penalty minutes: " $
editPlayer . (pYtd.psPMin .~)
-- | Prompt to edit a player's lifetime goals
editPlayerLtGoalsPrompt :: Prompt
editPlayerLtGoalsPrompt = numPrompt "Lifetime goals: " $
editPlayer . (pLifetime.psGoals .~)
editPlayer :: (Player -> Player) -> Action ()
editPlayer f =
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->