renaned setGoalieNumber to editGoalieNumber

This commit is contained in:
Jonathan Lamothe 2019-11-13 11:06:12 -05:00
parent 0b3d70e7c3
commit 6c4b08bfcd
3 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
-} -}
module Mtlstats.Actions.EditGoalie module Mtlstats.Actions.EditGoalie
( setGoalieNumber ( editGoalieNumber
) where ) where
import Control.Monad (void) import Control.Monad (void)
@ -30,13 +30,13 @@ import Lens.Micro ((^.), (&), (.~), (%~))
import Mtlstats.Types import Mtlstats.Types
import Mtlstats.Util import Mtlstats.Util
-- | Sets a goalie's number -- | Edits a goalie's number
setGoalieNumber editGoalieNumber
:: Int :: Int
-- ^ New goalie number -- ^ New goalie number
-> ProgState -> ProgState
-> ProgState -> ProgState
setGoalieNumber n s = fromMaybe s $ do editGoalieNumber n s = fromMaybe s $ do
gid <- s^.progMode.editGoalieStateL.egsSelectedGoalie gid <- s^.progMode.editGoalieStateL.egsSelectedGoalie
void $ nth gid $ s^.database.dbGoalies void $ nth gid $ s^.database.dbGoalies
let updateGoalie = gNumber .~ n let updateGoalie = gNumber .~ n

View File

@ -39,4 +39,4 @@ goalieToEditPrompt = selectGoaliePrompt "Goalie to edit: " $
-- | Prompt to edit a goalie's number -- | Prompt to edit a goalie's number
editGoalieNumberPrompt :: Prompt editGoalieNumberPrompt :: Prompt
editGoalieNumberPrompt = numPrompt "Goalie number: " $ editGoalieNumberPrompt = numPrompt "Goalie number: " $
modify . setGoalieNumber modify . editGoalieNumber

View File

@ -31,10 +31,10 @@ import Mtlstats.Util
spec :: Spec spec :: Spec
spec = describe "EditGoalie" spec = describe "EditGoalie"
setGoalieNumberSpec editGoalieNumberSpec
setGoalieNumberSpec :: Spec editGoalieNumberSpec :: Spec
setGoalieNumberSpec = describe "setGoalieNumber" $ do editGoalieNumberSpec = describe "editGoalieNumber" $ do
let let
joe = newGoalie 2 "Joe" joe = newGoalie 2 "Joe"
bob = newGoalie 3 "Bob" bob = newGoalie 3 "Bob"
@ -43,7 +43,7 @@ setGoalieNumberSpec = describe "setGoalieNumber" $ do
progState m = newProgState progState m = newProgState
& progMode .~ m & progMode .~ m
& database .~ db & database .~ db
& setGoalieNumber 5 & editGoalieNumber 5
mapM_ mapM_
(\(setLabel, setGid, mode, joeData, bobData) -> context setLabel $ do (\(setLabel, setGid, mode, joeData, bobData) -> context setLabel $ do