Merge pull request #56 from mtlstats/edit-return
make player edit prompts return to the appropriate menus
This commit is contained in:
commit
1f3ff5912c
|
@ -3,6 +3,7 @@
|
||||||
## current
|
## current
|
||||||
- Don't show player number zero in reports
|
- Don't show player number zero in reports
|
||||||
- Fixed player/goalie name capitalisation on edit
|
- Fixed player/goalie name capitalisation on edit
|
||||||
|
- Return to correct edit menus after editing player stats
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
- Bugfix: Display lifetime stats in report, not YTD
|
- Bugfix: Display lifetime stats in report, not YTD
|
||||||
|
|
|
@ -42,51 +42,51 @@ import Mtlstats.Util
|
||||||
-- | Prompt to edit a player's number
|
-- | Prompt to edit a player's number
|
||||||
editPlayerNumPrompt :: Prompt
|
editPlayerNumPrompt :: Prompt
|
||||||
editPlayerNumPrompt = numPrompt "Player number: " $
|
editPlayerNumPrompt = numPrompt "Player number: " $
|
||||||
editPlayer . (pNumber .~)
|
editPlayer EPMenu . (pNumber .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's name
|
-- | Prompt to edit a player's name
|
||||||
editPlayerNamePrompt :: Prompt
|
editPlayerNamePrompt :: Prompt
|
||||||
editPlayerNamePrompt = namePrompt "Player name: " $
|
editPlayerNamePrompt = namePrompt "Player name: " $
|
||||||
editPlayer . (pName .~)
|
editPlayer EPMenu . (pName .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's position
|
-- | Prompt to edit a player's position
|
||||||
editPlayerPosPrompt :: Prompt
|
editPlayerPosPrompt :: Prompt
|
||||||
editPlayerPosPrompt = ucStrPrompt "Player position: " $
|
editPlayerPosPrompt = ucStrPrompt "Player position: " $
|
||||||
editPlayer . (pPosition .~)
|
editPlayer EPMenu . (pPosition .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's year-to-date goals
|
-- | Prompt to edit a player's year-to-date goals
|
||||||
editPlayerYtdGoalsPrompt :: Prompt
|
editPlayerYtdGoalsPrompt :: Prompt
|
||||||
editPlayerYtdGoalsPrompt = numPrompt "Year-to-date goals: " $
|
editPlayerYtdGoalsPrompt = numPrompt "Year-to-date goals: " $
|
||||||
editPlayer . (pYtd.psGoals .~)
|
editPlayer EPYtd . (pYtd.psGoals .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's year-to-date assists
|
-- | Prompt to edit a player's year-to-date assists
|
||||||
editPlayerYtdAssistsPrompt :: Prompt
|
editPlayerYtdAssistsPrompt :: Prompt
|
||||||
editPlayerYtdAssistsPrompt = numPrompt "Year-to-date assists: " $
|
editPlayerYtdAssistsPrompt = numPrompt "Year-to-date assists: " $
|
||||||
editPlayer . (pYtd.psAssists .~)
|
editPlayer EPYtd . (pYtd.psAssists .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's year-to-date penalty minutes
|
-- | Prompt to edit a player's year-to-date penalty minutes
|
||||||
editPlayerYtdPMinPrompt :: Prompt
|
editPlayerYtdPMinPrompt :: Prompt
|
||||||
editPlayerYtdPMinPrompt = numPrompt "Year-to-date penalty minutes: " $
|
editPlayerYtdPMinPrompt = numPrompt "Year-to-date penalty minutes: " $
|
||||||
editPlayer . (pYtd.psPMin .~)
|
editPlayer EPYtd . (pYtd.psPMin .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's lifetime goals
|
-- | Prompt to edit a player's lifetime goals
|
||||||
editPlayerLtGoalsPrompt :: Prompt
|
editPlayerLtGoalsPrompt :: Prompt
|
||||||
editPlayerLtGoalsPrompt = numPrompt "Lifetime goals: " $
|
editPlayerLtGoalsPrompt = numPrompt "Lifetime goals: " $
|
||||||
editPlayer . (pLifetime.psGoals .~)
|
editPlayer EPLifetime . (pLifetime.psGoals .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's lifetime assists
|
-- | Prompt to edit a player's lifetime assists
|
||||||
editPlayerLtAssistsPrompt :: Prompt
|
editPlayerLtAssistsPrompt :: Prompt
|
||||||
editPlayerLtAssistsPrompt = numPrompt "Lifetime assists: " $
|
editPlayerLtAssistsPrompt = numPrompt "Lifetime assists: " $
|
||||||
editPlayer . (pLifetime.psAssists .~)
|
editPlayer EPLifetime . (pLifetime.psAssists .~)
|
||||||
|
|
||||||
-- | Prompt to edit a player's lifetime penalty minutes
|
-- | Prompt to edit a player's lifetime penalty minutes
|
||||||
editPlayerLtPMinPrompt :: Prompt
|
editPlayerLtPMinPrompt :: Prompt
|
||||||
editPlayerLtPMinPrompt = numPrompt "Lifetime penalty minutes: " $
|
editPlayerLtPMinPrompt = numPrompt "Lifetime penalty minutes: " $
|
||||||
editPlayer . (pLifetime.psPMin .~)
|
editPlayer EPLifetime . (pLifetime.psPMin .~)
|
||||||
|
|
||||||
editPlayer :: (Player -> Player) -> Action ()
|
editPlayer :: EditPlayerMode -> (Player -> Player) -> Action ()
|
||||||
editPlayer f =
|
editPlayer mode f =
|
||||||
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->
|
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->
|
||||||
modify
|
modify
|
||||||
$ (database.dbPlayers %~ modifyNth pid f)
|
$ (database.dbPlayers %~ modifyNth pid f)
|
||||||
. (progMode.editPlayerStateL.epsMode .~ EPMenu)
|
. (progMode.editPlayerStateL.epsMode .~ mode)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user