From 9c7c295a4b00b814577a6400a9b0f6f4016eaaaa Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Thu, 16 Jan 2020 15:00:08 -0500 Subject: [PATCH] implemented editAwayStandings --- src/Mtlstats/Actions/EditStandings.hs | 6 +++--- src/Mtlstats/Control/EditStandings.hs | 4 ++++ src/Mtlstats/Menu/EditStandings.hs | 2 +- src/Mtlstats/Types.hs | 1 + test/Actions/EditStandingsSpec.hs | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Mtlstats/Actions/EditStandings.hs b/src/Mtlstats/Actions/EditStandings.hs index 7da6038..6562b00 100644 --- a/src/Mtlstats/Actions/EditStandings.hs +++ b/src/Mtlstats/Actions/EditStandings.hs @@ -22,7 +22,7 @@ along with this program. If not, see . module Mtlstats.Actions.EditStandings ( editStandings , editHomeStandings - , editRoadStandings + , editAwayStandings ) where import Lens.Micro ((.~)) @@ -38,5 +38,5 @@ editHomeStandings :: ProgState -> ProgState editHomeStandings = progMode .~ EditStandings ESMHome -- | Edits the road standings -editRoadStandings :: ProgState -> ProgState -editRoadStandings = undefined +editAwayStandings :: ProgState -> ProgState +editAwayStandings = progMode .~ EditStandings ESMAway diff --git a/src/Mtlstats/Control/EditStandings.hs b/src/Mtlstats/Control/EditStandings.hs index fb8d74f..c5634c4 100644 --- a/src/Mtlstats/Control/EditStandings.hs +++ b/src/Mtlstats/Control/EditStandings.hs @@ -36,10 +36,14 @@ editStandingsC :: EditStandingsMode -> Controller editStandingsC = \case ESMMenu -> menuControllerWith header editStandingsMenu ESMHome -> editHomeStandingsC + ESMAway -> editAwayStandingsC editHomeStandingsC :: Controller editHomeStandingsC = undefined +editAwayStandingsC :: Controller +editAwayStandingsC = undefined + header :: ProgState -> C.Update () header = do db <- (^.database) diff --git a/src/Mtlstats/Menu/EditStandings.hs b/src/Mtlstats/Menu/EditStandings.hs index 1f185a2..9ef9b31 100644 --- a/src/Mtlstats/Menu/EditStandings.hs +++ b/src/Mtlstats/Menu/EditStandings.hs @@ -32,7 +32,7 @@ editStandingsMenu = Menu "*** EDIT STANDINGS ***" () [ MenuItem '1' "Edit home standings" $ modify editHomeStandings , MenuItem '2' "Edit road standings" $ - modify editRoadStandings + modify editAwayStandings , MenuItem 'R' "Return to main menu" $ modify backHome ] diff --git a/src/Mtlstats/Types.hs b/src/Mtlstats/Types.hs index 78883c5..e77b0ab 100644 --- a/src/Mtlstats/Types.hs +++ b/src/Mtlstats/Types.hs @@ -397,6 +397,7 @@ data EditGoalieMode data EditStandingsMode = ESMMenu | ESMHome + | ESMAway deriving (Eq, Show) -- | Represents the database diff --git a/test/Actions/EditStandingsSpec.hs b/test/Actions/EditStandingsSpec.hs index 219fa3d..7b80f8e 100644 --- a/test/Actions/EditStandingsSpec.hs +++ b/test/Actions/EditStandingsSpec.hs @@ -47,4 +47,5 @@ spec = describe "EditStandings" $ mapM_ -- label, function, expected mode [ ( "editStandings", editStandings, ESMMenu ) , ( "editHomeStandings", editHomeStandings, ESMHome ) + , ( "editAwayStandings", editAwayStandings, ESMAway ) ]