implemented new season handler

This commit is contained in:
Jonathan Lamothe 2019-08-20 12:50:39 -04:00
parent 76b4b85a0f
commit 27761d2b87
2 changed files with 14 additions and 2 deletions

View File

@ -19,7 +19,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
-} -}
module Mtlstats.Actions (startNewSeason, startNewGame) where module Mtlstats.Actions
( startNewSeason
, resetYtd
, startNewGame
) where
import Lens.Micro ((.~)) import Lens.Micro ((.~))
@ -29,6 +33,10 @@ import Mtlstats.Types
startNewSeason :: ProgState -> ProgState startNewSeason :: ProgState -> ProgState
startNewSeason = (progMode .~ NewSeason) . (database . dbGames .~ 0) startNewSeason = (progMode .~ NewSeason) . (database . dbGames .~ 0)
-- | Resets all players year-to-date stats
resetYtd :: ProgState -> ProgState
resetYtd = undefined
-- | Starts a new game -- | Starts a new game
startNewGame :: ProgState -> ProgState startNewGame :: ProgState -> ProgState
startNewGame = undefined startNewGame = undefined

View File

@ -50,7 +50,11 @@ mainMenu (C.EventCharacter c) = case c of
mainMenu _ = return True mainMenu _ = return True
newSeason :: C.Event -> StateT ProgState C.Curses () 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 :: C.Event -> StateT ProgState C.Curses ()
newGame = undefined newGame = undefined