edit lifetime stats on new player creation
This commit is contained in:
parent
ffc1390755
commit
95e74accd4
|
@ -24,7 +24,7 @@ module Mtlstats.Control.CreatePlayer (createPlayerC) where
|
||||||
import Control.Monad (join)
|
import Control.Monad (join)
|
||||||
import Control.Monad.Trans.State (gets, modify)
|
import Control.Monad.Trans.State (gets, modify)
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust)
|
||||||
import Lens.Micro ((^.))
|
import Lens.Micro ((^.), (.~), (?~), (%~), to)
|
||||||
import qualified UI.NCurses as C
|
import qualified UI.NCurses as C
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
|
@ -76,8 +76,14 @@ confirmCreatePlayerC = Controller
|
||||||
, handleController = \e -> do
|
, handleController = \e -> do
|
||||||
case ynHandler e of
|
case ynHandler e of
|
||||||
Just True -> do
|
Just True -> do
|
||||||
modify addPlayer
|
pid <- gets (^.database.dbPlayers.to length)
|
||||||
join $ gets (^.progMode.createPlayerStateL.cpsSuccessCallback)
|
cb <- gets (^.progMode.createPlayerStateL.cpsSuccessCallback)
|
||||||
|
modify
|
||||||
|
$ (progMode.editPlayerStateL
|
||||||
|
%~ (epsSelectedPlayer ?~ pid)
|
||||||
|
. (epsMode .~ EPLtGoals True)
|
||||||
|
. (epsCallback .~ cb))
|
||||||
|
. addPlayer
|
||||||
Just False ->
|
Just False ->
|
||||||
join $ gets (^.progMode.createPlayerStateL.cpsFailureCallback)
|
join $ gets (^.progMode.createPlayerStateL.cpsFailureCallback)
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user