allow user to edit goalie shutouts
This commit is contained in:
parent
0448a4beee
commit
aff1d5c255
|
@ -5,6 +5,7 @@
|
|||
- Fixed player/goalie name capitalisation on edit
|
||||
- Return to correct edit menus after editing player stats
|
||||
- Enabled batch editing of player/goalie YTD/lifetime stats
|
||||
- Bugfix: allow user to edit goalie shutouts
|
||||
|
||||
## 0.9.0
|
||||
- Bugfix: Display lifetime stats in report, not YTD
|
||||
|
|
|
@ -46,23 +46,25 @@ selectC = promptController goalieToEditPrompt
|
|||
|
||||
editC :: EditGoalieMode -> Controller
|
||||
editC = \case
|
||||
EGMenu -> menuC
|
||||
EGNumber -> numberC
|
||||
EGName -> nameC
|
||||
EGYtd -> ytdMenuC
|
||||
EGLifetime -> lifetimeMenuC
|
||||
EGYtdGames b -> ytdGamesC b
|
||||
EGYtdMins b -> ytdMinsC b
|
||||
EGYtdGoals b -> ytdGoalsC b
|
||||
EGYtdWins b -> ytdWinsC b
|
||||
EGYtdLosses b -> ytdLossesC b
|
||||
EGYtdTies -> ytdTiesC
|
||||
EGLtGames b -> ltGamesC b
|
||||
EGLtMins b -> ltMinsC b
|
||||
EGLtGoals b -> ltGoalsC b
|
||||
EGLtWins b -> ltWinsC b
|
||||
EGLtLosses b -> ltLossesC b
|
||||
EGLtTies -> ltTiesC
|
||||
EGMenu -> menuC
|
||||
EGNumber -> numberC
|
||||
EGName -> nameC
|
||||
EGYtd -> ytdMenuC
|
||||
EGLifetime -> lifetimeMenuC
|
||||
EGYtdGames b -> ytdGamesC b
|
||||
EGYtdMins b -> ytdMinsC b
|
||||
EGYtdGoals b -> ytdGoalsC b
|
||||
EGYtdShutouts b -> ytdShutoutsC b
|
||||
EGYtdWins b -> ytdWinsC b
|
||||
EGYtdLosses b -> ytdLossesC b
|
||||
EGYtdTies -> ytdTiesC
|
||||
EGLtGames b -> ltGamesC b
|
||||
EGLtMins b -> ltMinsC b
|
||||
EGLtGoals b -> ltGoalsC b
|
||||
EGLtShutouts b -> ltShutoutsC b
|
||||
EGLtWins b -> ltWinsC b
|
||||
EGLtLosses b -> ltLossesC b
|
||||
EGLtTies -> ltTiesC
|
||||
|
||||
menuC :: Controller
|
||||
menuC = menuControllerWith header editGoalieMenu
|
||||
|
@ -88,6 +90,9 @@ ytdMinsC = promptController . editGoalieYtdMinsPrompt
|
|||
ytdGoalsC :: Bool -> Controller
|
||||
ytdGoalsC = promptController . editGoalieYtdGoalsPrompt
|
||||
|
||||
ytdShutoutsC :: Bool -> Controller
|
||||
ytdShutoutsC = promptController . editGoalieYtdShutoutsPrompt
|
||||
|
||||
ytdWinsC :: Bool -> Controller
|
||||
ytdWinsC = promptController . editGoalieYtdWinsPrompt
|
||||
|
||||
|
@ -106,6 +111,9 @@ ltMinsC = promptController . editGoalieLtMinsPrompt
|
|||
ltGoalsC :: Bool -> Controller
|
||||
ltGoalsC = promptController . editGoalieLtGoalsPrompt
|
||||
|
||||
ltShutoutsC :: Bool -> Controller
|
||||
ltShutoutsC = promptController . editGoalieLtShutoutsPrompt
|
||||
|
||||
ltWinsC :: Bool -> Controller
|
||||
ltWinsC = promptController . editGoalieLtWinsPrompt
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ goalieDetails g = let
|
|||
[ ( "Games played", gsGames )
|
||||
, ( "Mins played", gsMinsPlayed )
|
||||
, ( "Goals allowed", gsGoalsAllowed )
|
||||
, ( "Shutouts", gsShutouts )
|
||||
, ( "Wins", gsWins )
|
||||
, ( "Losses", gsLosses )
|
||||
, ( "Ties", gsTies )
|
||||
|
|
|
@ -51,14 +51,15 @@ editGoalieMenu = Menu "*** EDIT GOALTENDER ***" () $ map
|
|||
editGoalieYtdMenu :: Menu ()
|
||||
editGoalieYtdMenu = editMenu "*** EDIT GOALTENDER YEAR-TO-DATE ***"
|
||||
-- key, label, value
|
||||
[ ( '1', "Edit all YTD stats", EGYtdGames True )
|
||||
, ( '2', "Edit YTD games", EGYtdGames False )
|
||||
, ( '3', "Edit YTD minutes", EGYtdMins False )
|
||||
, ( '4', "Edit YTD goals", EGYtdGoals False )
|
||||
, ( '5', "Edit YTD wins", EGYtdWins False )
|
||||
, ( '6', "Edit YTD losses", EGYtdLosses False )
|
||||
, ( '7', "Edit YTD ties", EGYtdTies )
|
||||
, ( 'R', "Return to edit menu", EGMenu )
|
||||
[ ( '1', "Edit all YTD stats", EGYtdGames True )
|
||||
, ( '2', "Edit YTD games", EGYtdGames False )
|
||||
, ( '3', "Edit YTD minutes", EGYtdMins False )
|
||||
, ( '4', "Edit YTD goals", EGYtdGoals False )
|
||||
, ( '5', "Edit YTD shutouts", EGYtdShutouts False )
|
||||
, ( '6', "Edit YTD wins", EGYtdWins False )
|
||||
, ( '7', "Edit YTD losses", EGYtdLosses False )
|
||||
, ( '8', "Edit YTD ties", EGYtdTies )
|
||||
, ( 'R', "Return to edit menu", EGMenu )
|
||||
]
|
||||
|
||||
-- | The 'Goalie' lifetime edit menu
|
||||
|
@ -66,14 +67,15 @@ editGoalieLtMenu :: Menu ()
|
|||
editGoalieLtMenu = editMenu
|
||||
"*** EDIT GOALTENDER LIFETIME ***"
|
||||
-- key, label, value
|
||||
[ ( '1', "Edit all lifetime stats", EGLtGames True )
|
||||
, ( '2', "Edit lifetime games", EGLtGames False )
|
||||
, ( '3', "Edit lifetime minutes", EGLtMins False )
|
||||
, ( '4', "Edit lifetime goals", EGLtGoals False )
|
||||
, ( '5', "Edit lifetime wins", EGLtWins False )
|
||||
, ( '6', "Edit lifetime losses", EGLtLosses False )
|
||||
, ( '7', "Edit lifetime ties", EGLtTies )
|
||||
, ( 'R', "Return to edit menu", EGMenu )
|
||||
[ ( '1', "Edit all lifetime stats", EGLtGames True )
|
||||
, ( '2', "Edit lifetime games", EGLtGames False )
|
||||
, ( '3', "Edit lifetime minutes", EGLtMins False )
|
||||
, ( '4', "Edit lifetime goals", EGLtGoals False )
|
||||
, ( '5', "Edit lifetime shutouts", EGLtShutouts False )
|
||||
, ( '6', "Edit lifetime wins", EGLtWins False )
|
||||
, ( '7', "Edit lifetime losses", EGLtLosses False )
|
||||
, ( '8', "Edit lifetime ties", EGLtTies )
|
||||
, ( 'R', "Return to edit menu", EGMenu )
|
||||
]
|
||||
|
||||
editMenu :: String -> [(Char, String, EditGoalieMode)] -> Menu ()
|
||||
|
|
|
@ -26,12 +26,14 @@ module Mtlstats.Prompt.EditGoalie
|
|||
, editGoalieYtdGamesPrompt
|
||||
, editGoalieYtdMinsPrompt
|
||||
, editGoalieYtdGoalsPrompt
|
||||
, editGoalieYtdShutoutsPrompt
|
||||
, editGoalieYtdWinsPrompt
|
||||
, editGoalieYtdLossesPrompt
|
||||
, editGoalieYtdTiesPrompt
|
||||
, editGoalieLtGamesPrompt
|
||||
, editGoalieLtMinsPrompt
|
||||
, editGoalieLtGoalsPrompt
|
||||
, editGoalieLtShutoutsPrompt
|
||||
, editGoalieLtWinsPrompt
|
||||
, editGoalieLtLossesPrompt
|
||||
, editGoalieLtTiesPrompt
|
||||
|
@ -92,6 +94,17 @@ editGoalieYtdGoalsPrompt
|
|||
editGoalieYtdGoalsPrompt batchMode =
|
||||
editNum "Year-to-date goals allowed: " mode
|
||||
(gYtd.gsGoalsAllowed .~)
|
||||
where
|
||||
mode = if batchMode then EGYtdShutouts True else EGYtd
|
||||
|
||||
-- | Prompt to edit a goalie's YTD shutouts
|
||||
editGoalieYtdShutoutsPrompt
|
||||
:: Bool
|
||||
-- ^ Indicates whether or not we're in batch mode
|
||||
-> Prompt
|
||||
editGoalieYtdShutoutsPrompt batchMode =
|
||||
editNum "Year-to-date shutouts: " mode
|
||||
(gYtd.gsShutouts .~)
|
||||
where
|
||||
mode = if batchMode then EGYtdWins True else EGYtd
|
||||
|
||||
|
@ -152,6 +165,17 @@ editGoalieLtGoalsPrompt
|
|||
editGoalieLtGoalsPrompt batchMode =
|
||||
editNum "Lifetime goals allowed: " mode
|
||||
(gLifetime.gsGoalsAllowed .~)
|
||||
where
|
||||
mode = if batchMode then EGLtShutouts True else EGLifetime
|
||||
|
||||
-- | Prompt to edit a goalie's lifetime shutouts
|
||||
editGoalieLtShutoutsPrompt
|
||||
:: Bool
|
||||
-- ^ Indicates whether or not we're in batch mode
|
||||
-> Prompt
|
||||
editGoalieLtShutoutsPrompt batchMode =
|
||||
editNum "Lifetime shutouts: " mode
|
||||
(gLifetime.gsShutouts .~)
|
||||
where
|
||||
mode = if batchMode then EGLtWins True else EGLifetime
|
||||
|
||||
|
|
|
@ -369,17 +369,19 @@ data EditGoalieMode
|
|||
| EGName
|
||||
| EGYtd
|
||||
| EGLifetime
|
||||
| EGYtdGames Bool
|
||||
| EGYtdMins Bool
|
||||
| EGYtdGoals Bool
|
||||
| EGYtdWins Bool
|
||||
| EGYtdLosses Bool
|
||||
| EGYtdGames Bool
|
||||
| EGYtdMins Bool
|
||||
| EGYtdGoals Bool
|
||||
| EGYtdShutouts Bool
|
||||
| EGYtdWins Bool
|
||||
| EGYtdLosses Bool
|
||||
| EGYtdTies
|
||||
| EGLtGames Bool
|
||||
| EGLtMins Bool
|
||||
| EGLtGoals Bool
|
||||
| EGLtWins Bool
|
||||
| EGLtLosses Bool
|
||||
| EGLtGames Bool
|
||||
| EGLtMins Bool
|
||||
| EGLtGoals Bool
|
||||
| EGLtShutouts Bool
|
||||
| EGLtWins Bool
|
||||
| EGLtLosses Bool
|
||||
| EGLtTies
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
|
|
@ -38,28 +38,31 @@ goalieDetailsSpec = describe "goalieDetails" $ let
|
|||
%~ ( gsGames .~ 2 )
|
||||
. ( gsMinsPlayed .~ 3 )
|
||||
. ( gsGoalsAllowed .~ 4 )
|
||||
. ( gsWins .~ 5 )
|
||||
. ( gsLosses .~ 6 )
|
||||
. ( gsTies .~ 7 )
|
||||
. ( gsShutouts .~ 5 )
|
||||
. ( gsWins .~ 6 )
|
||||
. ( gsLosses .~ 7 )
|
||||
. ( gsTies .~ 8 )
|
||||
& gLifetime
|
||||
%~ ( gsGames .~ 8 )
|
||||
. ( gsMinsPlayed .~ 9 )
|
||||
. ( gsGoalsAllowed .~ 10 )
|
||||
. ( gsWins .~ 11 )
|
||||
. ( gsLosses .~ 12 )
|
||||
. ( gsTies .~ 13 )
|
||||
%~ ( gsGames .~ 9 )
|
||||
. ( gsMinsPlayed .~ 10 )
|
||||
. ( gsGoalsAllowed .~ 11 )
|
||||
. ( gsShutouts .~ 12 )
|
||||
. ( gsWins .~ 13 )
|
||||
. ( gsLosses .~ 14 )
|
||||
. ( gsTies .~ 15 )
|
||||
|
||||
expected = unlines
|
||||
[ "Number: 1"
|
||||
, " Name: Joe"
|
||||
, ""
|
||||
, " YTD Lifetime"
|
||||
, " Games played 2 8"
|
||||
, " Mins played 3 9"
|
||||
, "Goals allowed 4 10"
|
||||
, " Wins 5 11"
|
||||
, " Losses 6 12"
|
||||
, " Ties 7 13"
|
||||
, " Games played 2 9"
|
||||
, " Mins played 3 10"
|
||||
, "Goals allowed 4 11"
|
||||
, " Shutouts 5 12"
|
||||
, " Wins 6 13"
|
||||
, " Losses 7 14"
|
||||
, " Ties 8 15"
|
||||
]
|
||||
|
||||
in it "should format the output correctly" $
|
||||
|
|
Loading…
Reference in New Issue
Block a user