From 9840e5a90e5b737ec631eda1f21ebcadb1dffcfd Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Fri, 1 Nov 2019 06:40:48 -0400 Subject: [PATCH] implemented lifetime goals editing --- src/Mtlstats/Control/EditPlayer.hs | 7 ++++++- src/Mtlstats/Prompt/EditPlayer.hs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Mtlstats/Control/EditPlayer.hs b/src/Mtlstats/Control/EditPlayer.hs index 49ae3f1..aade0e0 100644 --- a/src/Mtlstats/Control/EditPlayer.hs +++ b/src/Mtlstats/Control/EditPlayer.hs @@ -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 diff --git a/src/Mtlstats/Prompt/EditPlayer.hs b/src/Mtlstats/Prompt/EditPlayer.hs index 7fcabc7..6890395 100644 --- a/src/Mtlstats/Prompt/EditPlayer.hs +++ b/src/Mtlstats/Prompt/EditPlayer.hs @@ -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 ->