reset game standings on new season
This commit is contained in:
@@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module Mtlstats.Actions
|
||||
( startNewSeason
|
||||
, resetYtd
|
||||
, resetStandings
|
||||
, startNewGame
|
||||
, addChar
|
||||
, removeChar
|
||||
@@ -56,6 +57,12 @@ resetYtd
|
||||
= (database . dbPlayers %~ map (pYtd .~ newPlayerStats))
|
||||
. (database . dbGoalies %~ map (gYtd .~ newGoalieStats))
|
||||
|
||||
-- | Resets game standings
|
||||
resetStandings :: ProgState -> ProgState
|
||||
resetStandings = database
|
||||
%~ ( dbHomeGameStats .~ newGameStats)
|
||||
. ( dbAwayGameStats .~ newGameStats)
|
||||
|
||||
-- | Starts a new game
|
||||
startNewGame :: ProgState -> ProgState
|
||||
startNewGame
|
||||
|
||||
@@ -119,11 +119,13 @@ mainMenu = Menu "*** MAIN MENU ***" True
|
||||
-- | The new season menu
|
||||
newSeasonMenu :: Menu ()
|
||||
newSeasonMenu = Menu "*** SEASON TYPE ***" ()
|
||||
[ MenuItem '1' "Regular Season" $ do
|
||||
modify resetYtd
|
||||
modify startNewGame
|
||||
, MenuItem '2' "Playoffs" $
|
||||
modify startNewGame
|
||||
[ MenuItem '1' "Regular Season" $ modify
|
||||
$ resetYtd
|
||||
. resetStandings
|
||||
. startNewGame
|
||||
, MenuItem '2' "Playoffs" $ modify
|
||||
$ resetStandings
|
||||
. startNewGame
|
||||
]
|
||||
|
||||
-- | Requests the month in which the game took place
|
||||
|
||||
Reference in New Issue
Block a user