only ask for goalie lifetime stats when not rookie

This commit is contained in:
Jonathan Lamothe
2020-02-13 20:03:27 -05:00
parent e51953650c
commit 6bb4601e6b

View File

@@ -21,7 +21,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Control.CreateGoalie (createGoalieC) where module Mtlstats.Control.CreateGoalie (createGoalieC) where
import Control.Monad (join)
import Control.Monad.Trans.State (gets, modify) import Control.Monad.Trans.State (gets, modify)
import Lens.Micro ((^.), (.~), (?~), (%~), to) import Lens.Micro ((^.), (.~), (?~), (%~), to)
import qualified UI.NCurses as C import qualified UI.NCurses as C
@@ -71,18 +70,22 @@ confirmCreateGoalieC = Controller
] ]
return C.CursorInvisible return C.CursorInvisible
, handleController = \e -> do , handleController = \e -> do
cgs <- gets (^.progMode.createGoalieStateL)
let
success = cgs^.cgsSuccessCallback
failure = cgs^.cgsFailureCallback
case ynHandler e of case ynHandler e of
Just True -> do Just True -> do
gid <- gets (^.database.dbGoalies.to length) gid <- gets (^.database.dbGoalies.to length)
cb <- gets (^.progMode.createGoalieStateL.cgsSuccessCallback) let rookie = cgs^.cgsRookieFlag == Just True
modify modify addGoalie
$ (progMode.editGoalieStateL if rookie
then success
else modify $ progMode.editGoalieStateL
%~ (egsSelectedGoalie ?~ gid) %~ (egsSelectedGoalie ?~ gid)
. (egsMode .~ EGLtGames True) . (egsMode .~ EGLtGames True)
. (egsCallback .~ cb)) . (egsCallback .~ success)
. addGoalie Just False -> failure
Just False ->
join $ gets (^.progMode.createGoalieStateL.cgsFailureCallback)
Nothing -> return () Nothing -> return ()
return True return True
} }