diff --git a/src/Mtlstats/Control/EditPlayer.hs b/src/Mtlstats/Control/EditPlayer.hs index 1aeb464..812f971 100644 --- a/src/Mtlstats/Control/EditPlayer.hs +++ b/src/Mtlstats/Control/EditPlayer.hs @@ -38,18 +38,18 @@ editPlayerC :: EditPlayerState -> Controller editPlayerC eps | null $ eps^.epsSelectedPlayer = selectPlayerC | otherwise = case eps^.epsMode of - EPMenu -> menuC - EPNumber -> numberC - EPName -> nameC - EPPosition -> positionC - EPYtd -> ytdC - EPLifetime -> lifetimeC - EPYtdGoals -> ytdGoalsC - EPYtdAssists -> ytdAssistsC - EPYtdPMin -> ytdPMinC - EPLtGoals -> ltGoalsC - EPLtAssists -> ltAssistsC - EPLtPMin -> ltPMinC + EPMenu -> menuC + EPNumber -> numberC + EPName -> nameC + EPPosition -> positionC + EPYtd -> ytdC + EPLifetime -> lifetimeC + EPYtdGoals b -> ytdGoalsC b + EPYtdAssists b -> ytdAssistsC b + EPYtdPMin -> ytdPMinC + EPLtGoals b -> ltGoalsC b + EPLtAssists b -> ltAssistsC b + EPLtPMin -> ltPMinC selectPlayerC :: Controller selectPlayerC = promptController playerToEditPrompt @@ -72,20 +72,20 @@ ytdC = menuControllerWith header editPlayerYtdMenu lifetimeC :: Controller lifetimeC = menuControllerWith header editPlayerLtMenu -ytdGoalsC :: Controller -ytdGoalsC = promptController editPlayerYtdGoalsPrompt +ytdGoalsC :: Bool -> Controller +ytdGoalsC = promptController . editPlayerYtdGoalsPrompt -ytdAssistsC :: Controller -ytdAssistsC = promptController editPlayerYtdAssistsPrompt +ytdAssistsC :: Bool -> Controller +ytdAssistsC = promptController . editPlayerYtdAssistsPrompt ytdPMinC :: Controller ytdPMinC = promptController editPlayerYtdPMinPrompt -ltGoalsC :: Controller -ltGoalsC = promptController editPlayerLtGoalsPrompt +ltGoalsC :: Bool -> Controller +ltGoalsC = promptController . editPlayerLtGoalsPrompt -ltAssistsC :: Controller -ltAssistsC = promptController editPlayerLtAssistsPrompt +ltAssistsC :: Bool -> Controller +ltAssistsC = promptController . editPlayerLtAssistsPrompt ltPMinC :: Controller ltPMinC = promptController editPlayerLtPMinPrompt diff --git a/src/Mtlstats/Menu/EditPlayer.hs b/src/Mtlstats/Menu/EditPlayer.hs index b0a0e0b..2b6312d 100644 --- a/src/Mtlstats/Menu/EditPlayer.hs +++ b/src/Mtlstats/Menu/EditPlayer.hs @@ -53,10 +53,11 @@ editPlayerYtdMenu :: Menu () editPlayerYtdMenu = editMenu "*** EDIT PLAYER YEAR-TO-DATE ***" -- key, label, value - [ ( '1', "Edit YTD goals", EPYtdGoals ) - , ( '2', "Edit YTD assists", EPYtdAssists ) - , ( '3', "Edit YTD penalty mins", EPYtdPMin ) - , ( 'R', "Return to player edit menu", EPMenu ) + [ ( '1', "Edit all YTD stats", EPYtdGoals True ) + , ( '2', "Edit YTD goals", EPYtdGoals False ) + , ( '3', "Edit YTD assists", EPYtdAssists False ) + , ( '4', "Edit YTD penalty mins", EPYtdPMin ) + , ( 'R', "Return to player edit menu", EPMenu ) ] -- | The 'Player' lifetime stats edit menu @@ -64,10 +65,11 @@ editPlayerLtMenu :: Menu () editPlayerLtMenu = editMenu "*** EDIT PLAYER LIFETIME ***" -- key, label, value - [ ( '1', "Edit lifetime goals", EPLtGoals ) - , ( '2', "Edit lifetime assits", EPLtAssists ) - , ( '3', "Edit lifetime penalty mins", EPLtPMin ) - , ( 'R', "Return to edit player menu", EPMenu ) + [ ( '1', "Edit all lifetime stats", EPLtGoals True ) + , ( '2', "Edit lifetime goals", EPLtGoals False ) + , ( '3', "Edit lifetime assits", EPLtAssists False ) + , ( '4', "Edit lifetime penalty mins", EPLtPMin ) + , ( 'R', "Return to edit player menu", EPMenu ) ] editMenu :: String -> [(Char, String, EditPlayerMode)] -> Menu () diff --git a/src/Mtlstats/Prompt/EditPlayer.hs b/src/Mtlstats/Prompt/EditPlayer.hs index 4d4f47e..91bb734 100644 --- a/src/Mtlstats/Prompt/EditPlayer.hs +++ b/src/Mtlstats/Prompt/EditPlayer.hs @@ -59,14 +59,24 @@ editPlayerPosPrompt = ucStrPrompt "Player position: " $ \pos -> else editPlayer EPMenu $ pPosition .~ pos -- | Prompt to edit a player's year-to-date goals -editPlayerYtdGoalsPrompt :: Prompt -editPlayerYtdGoalsPrompt = editNum "Year-to-date goals: " EPYtd +editPlayerYtdGoalsPrompt + :: Bool + -- ^ Indicates wheter or not we're editing in batch mode + -> Prompt +editPlayerYtdGoalsPrompt batchMode = editNum "Year-to-date goals: " mode (pYtd.psGoals .~) + where + mode = if batchMode then EPYtdAssists True else EPYtd -- | Prompt to edit a player's year-to-date assists -editPlayerYtdAssistsPrompt :: Prompt -editPlayerYtdAssistsPrompt = editNum "Year-to-date assists: " EPYtd +editPlayerYtdAssistsPrompt + :: Bool + -- ^ Indicates wheter or not we're editing in batch mode + -> Prompt +editPlayerYtdAssistsPrompt batchMode = editNum "Year-to-date assists: " mode (pYtd.psAssists .~) + where + mode = if batchMode then EPYtdPMin else EPYtd -- | Prompt to edit a player's year-to-date penalty minutes editPlayerYtdPMinPrompt :: Prompt @@ -74,14 +84,24 @@ editPlayerYtdPMinPrompt = editNum "Year-to-date penalty minutes: " EPYtd (pYtd.psPMin .~) -- | Prompt to edit a player's lifetime goals -editPlayerLtGoalsPrompt :: Prompt -editPlayerLtGoalsPrompt = editNum "Lifetime goals: " EPLifetime +editPlayerLtGoalsPrompt + :: Bool + -- ^ Indicates wheter or not we're editing in batch mode + -> Prompt +editPlayerLtGoalsPrompt batchMode = editNum "Lifetime goals: " mode (pLifetime.psGoals .~) + where + mode = if batchMode then EPLtAssists True else EPLifetime -- | Prompt to edit a player's lifetime assists -editPlayerLtAssistsPrompt :: Prompt -editPlayerLtAssistsPrompt = editNum "Lifetime assists: " EPLifetime +editPlayerLtAssistsPrompt + :: Bool + -- ^ Indicates wheter or not we're editing in batch mode + -> Prompt +editPlayerLtAssistsPrompt batchMode = editNum "Lifetime assists: " mode (pLifetime.psAssists .~) + where + mode = if batchMode then EPLtPMin else EPLifetime -- | Prompt to edit a player's lifetime penalty minutes editPlayerLtPMinPrompt :: Prompt diff --git a/src/Mtlstats/Types.hs b/src/Mtlstats/Types.hs index 6c5bc20..bf842d8 100644 --- a/src/Mtlstats/Types.hs +++ b/src/Mtlstats/Types.hs @@ -347,11 +347,11 @@ data EditPlayerMode | EPPosition | EPYtd | EPLifetime - | EPYtdGoals - | EPYtdAssists + | EPYtdGoals Bool + | EPYtdAssists Bool | EPYtdPMin - | EPLtGoals - | EPLtAssists + | EPLtGoals Bool + | EPLtAssists Bool | EPLtPMin deriving (Eq, Show)