diff --git a/src/Mtlstats/Actions/EditGoalie.hs b/src/Mtlstats/Actions/EditGoalie.hs index fdc599e..e896ded 100644 --- a/src/Mtlstats/Actions/EditGoalie.hs +++ b/src/Mtlstats/Actions/EditGoalie.hs @@ -20,7 +20,7 @@ along with this program. If not, see . -} module Mtlstats.Actions.EditGoalie - ( setGoalieNumber + ( editGoalieNumber ) where import Control.Monad (void) @@ -30,13 +30,13 @@ import Lens.Micro ((^.), (&), (.~), (%~)) import Mtlstats.Types import Mtlstats.Util --- | Sets a goalie's number -setGoalieNumber +-- | Edits a goalie's number +editGoalieNumber :: Int -- ^ New goalie number -> ProgState -> ProgState -setGoalieNumber n s = fromMaybe s $ do +editGoalieNumber n s = fromMaybe s $ do gid <- s^.progMode.editGoalieStateL.egsSelectedGoalie void $ nth gid $ s^.database.dbGoalies let updateGoalie = gNumber .~ n diff --git a/src/Mtlstats/Prompt/EditGoalie.hs b/src/Mtlstats/Prompt/EditGoalie.hs index 4ac60f1..e662ce4 100644 --- a/src/Mtlstats/Prompt/EditGoalie.hs +++ b/src/Mtlstats/Prompt/EditGoalie.hs @@ -39,4 +39,4 @@ goalieToEditPrompt = selectGoaliePrompt "Goalie to edit: " $ -- | Prompt to edit a goalie's number editGoalieNumberPrompt :: Prompt editGoalieNumberPrompt = numPrompt "Goalie number: " $ - modify . setGoalieNumber + modify . editGoalieNumber diff --git a/test/Actions/EditGoalieSpec.hs b/test/Actions/EditGoalieSpec.hs index 5dcb9ac..8c25851 100644 --- a/test/Actions/EditGoalieSpec.hs +++ b/test/Actions/EditGoalieSpec.hs @@ -31,10 +31,10 @@ import Mtlstats.Util spec :: Spec spec = describe "EditGoalie" - setGoalieNumberSpec + editGoalieNumberSpec -setGoalieNumberSpec :: Spec -setGoalieNumberSpec = describe "setGoalieNumber" $ do +editGoalieNumberSpec :: Spec +editGoalieNumberSpec = describe "editGoalieNumber" $ do let joe = newGoalie 2 "Joe" bob = newGoalie 3 "Bob" @@ -43,7 +43,7 @@ setGoalieNumberSpec = describe "setGoalieNumber" $ do progState m = newProgState & progMode .~ m & database .~ db - & setGoalieNumber 5 + & editGoalieNumber 5 mapM_ (\(setLabel, setGid, mode, joeData, bobData) -> context setLabel $ do