From 27761d2b8796257db31171b24d1dc6cfd876c896 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Tue, 20 Aug 2019 12:50:39 -0400 Subject: [PATCH] implemented new season handler --- src/Mtlstats/Actions.hs | 10 +++++++++- src/Mtlstats/Events.hs | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Mtlstats/Actions.hs b/src/Mtlstats/Actions.hs index 9978c50..39dc2e8 100644 --- a/src/Mtlstats/Actions.hs +++ b/src/Mtlstats/Actions.hs @@ -19,7 +19,11 @@ along with this program. If not, see . -} -module Mtlstats.Actions (startNewSeason, startNewGame) where +module Mtlstats.Actions + ( startNewSeason + , resetYtd + , startNewGame + ) where import Lens.Micro ((.~)) @@ -29,6 +33,10 @@ import Mtlstats.Types startNewSeason :: ProgState -> ProgState startNewSeason = (progMode .~ NewSeason) . (database . dbGames .~ 0) +-- | Resets all players year-to-date stats +resetYtd :: ProgState -> ProgState +resetYtd = undefined + -- | Starts a new game startNewGame :: ProgState -> ProgState startNewGame = undefined diff --git a/src/Mtlstats/Events.hs b/src/Mtlstats/Events.hs index 264d914..0172360 100644 --- a/src/Mtlstats/Events.hs +++ b/src/Mtlstats/Events.hs @@ -50,7 +50,11 @@ mainMenu (C.EventCharacter c) = case c of mainMenu _ = return True newSeason :: C.Event -> StateT ProgState C.Curses () -newSeason = undefined +newSeason (C.EventCharacter c) = case c of + '1' -> modify $ resetYtd . startNewGame + '2' -> modify startNewGame + _ -> return () +newSeason _ = return () newGame :: C.Event -> StateT ProgState C.Curses () newGame = undefined