2019-11-09 01:50:29 -05:00
|
|
|
{- |
|
|
|
|
|
|
|
|
mtlstats
|
|
|
|
Copyright (C) 2019 Rhéal Lamothe
|
|
|
|
<rheal.lamothe@gmail.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
|
|
your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
2019-11-11 20:38:20 -05:00
|
|
|
{-# LANGUAGE LambdaCase #-}
|
|
|
|
|
2019-11-09 01:50:29 -05:00
|
|
|
module Mtlstats.Control.EditGoalie (editGoalieC) where
|
|
|
|
|
2019-11-12 23:38:40 -05:00
|
|
|
import Data.Maybe (fromMaybe)
|
2019-11-09 02:01:44 -05:00
|
|
|
import Lens.Micro ((^.))
|
2019-11-11 20:47:50 -05:00
|
|
|
import UI.NCurses as C
|
2019-11-09 02:01:44 -05:00
|
|
|
|
2019-11-11 20:47:50 -05:00
|
|
|
import Mtlstats.Menu
|
2019-11-12 09:48:15 -05:00
|
|
|
import Mtlstats.Menu.EditGoalie
|
2019-11-09 02:05:51 -05:00
|
|
|
import Mtlstats.Prompt
|
|
|
|
import Mtlstats.Prompt.EditGoalie
|
2019-11-09 01:50:29 -05:00
|
|
|
import Mtlstats.Types
|
2019-11-12 23:38:40 -05:00
|
|
|
import Mtlstats.Util
|
2019-11-09 01:50:29 -05:00
|
|
|
|
|
|
|
-- | Controller/dispatcher for editing a 'Goalie'
|
|
|
|
editGoalieC :: EditGoalieState -> Controller
|
2019-11-09 02:01:44 -05:00
|
|
|
editGoalieC egs
|
|
|
|
| null $ egs^.egsSelectedGoalie = selectC
|
2019-11-11 20:38:20 -05:00
|
|
|
| otherwise = editC $ egs^.egsMode
|
2019-11-09 02:01:44 -05:00
|
|
|
|
|
|
|
selectC :: Controller
|
2019-11-09 02:05:51 -05:00
|
|
|
selectC = promptController goalieToEditPrompt
|
2019-11-09 02:01:44 -05:00
|
|
|
|
2019-11-11 20:38:20 -05:00
|
|
|
editC :: EditGoalieMode -> Controller
|
|
|
|
editC = \case
|
|
|
|
EGMenu -> menuC
|
|
|
|
EGNumber -> numberC
|
|
|
|
EGName -> nameC
|
2019-11-11 22:03:23 -05:00
|
|
|
EGYtd -> ytdMenuC
|
|
|
|
EGLifetime -> lifetimeMenuC
|
2019-11-11 20:38:20 -05:00
|
|
|
EGYtdGames -> ytdGamesC
|
|
|
|
EGYtdMins -> ytdMinsC
|
|
|
|
EGYtdGoals -> ytdGoalsC
|
|
|
|
EGYtdWins -> ytdWinsC
|
|
|
|
EGYtdLosses -> ytdLossesC
|
|
|
|
EGYtdTies -> ytdTiesC
|
|
|
|
EGLtGames -> ltGamesC
|
|
|
|
EGLtMins -> ltMinsC
|
|
|
|
EGLtGoals -> ltGoalsC
|
|
|
|
EGLtWins -> ltWinsC
|
|
|
|
EGLtLosses -> ltLossesC
|
|
|
|
EGLtTies -> ltTiesC
|
|
|
|
|
|
|
|
menuC :: Controller
|
2019-11-11 20:47:50 -05:00
|
|
|
menuC = menuControllerWith header editGoalieMenu
|
2019-11-11 20:38:20 -05:00
|
|
|
|
|
|
|
numberC :: Controller
|
|
|
|
numberC = undefined
|
|
|
|
|
|
|
|
nameC :: Controller
|
|
|
|
nameC = undefined
|
|
|
|
|
2019-11-11 22:03:23 -05:00
|
|
|
ytdMenuC :: Controller
|
|
|
|
ytdMenuC = undefined
|
|
|
|
|
|
|
|
lifetimeMenuC :: Controller
|
|
|
|
lifetimeMenuC = undefined
|
|
|
|
|
2019-11-11 20:38:20 -05:00
|
|
|
ytdGamesC :: Controller
|
|
|
|
ytdGamesC = undefined
|
|
|
|
|
|
|
|
ytdMinsC :: Controller
|
|
|
|
ytdMinsC = undefined
|
|
|
|
|
|
|
|
ytdGoalsC :: Controller
|
|
|
|
ytdGoalsC = undefined
|
|
|
|
|
|
|
|
ytdWinsC :: Controller
|
|
|
|
ytdWinsC = undefined
|
|
|
|
|
|
|
|
ytdLossesC :: Controller
|
|
|
|
ytdLossesC = undefined
|
|
|
|
|
|
|
|
ytdTiesC :: Controller
|
|
|
|
ytdTiesC = undefined
|
|
|
|
|
|
|
|
ltGamesC :: Controller
|
|
|
|
ltGamesC = undefined
|
|
|
|
|
|
|
|
ltMinsC :: Controller
|
|
|
|
ltMinsC = undefined
|
|
|
|
|
|
|
|
ltGoalsC :: Controller
|
|
|
|
ltGoalsC = undefined
|
|
|
|
|
|
|
|
ltWinsC :: Controller
|
|
|
|
ltWinsC = undefined
|
|
|
|
|
|
|
|
ltLossesC :: Controller
|
|
|
|
ltLossesC = undefined
|
|
|
|
|
|
|
|
ltTiesC :: Controller
|
|
|
|
ltTiesC = undefined
|
2019-11-11 20:47:50 -05:00
|
|
|
|
|
|
|
header :: ProgState -> C.Update ()
|
2019-11-12 23:38:40 -05:00
|
|
|
header s = C.drawString $ fromMaybe "" $ do
|
|
|
|
gid <- s^.progMode.editGoalieStateL.egsSelectedGoalie
|
|
|
|
g <- nth gid $ s^.database.dbGoalies
|
|
|
|
Just $ unlines
|
|
|
|
[ " Goalie number: " ++ show (g^.gNumber)
|
|
|
|
, " Goalie name: " ++ g^.gName
|
|
|
|
, " YTD games played: " ++ show (g^.gYtd.gsGames)
|
|
|
|
, " YTD mins played: " ++ show (g^.gYtd.gsMinsPlayed)
|
|
|
|
, " YTD goals allowed: " ++ show (g^.gYtd.gsGoalsAllowed)
|
|
|
|
, " YTD wins: " ++ show (g^.gYtd.gsWins)
|
|
|
|
, " YTD losses: " ++ show (g^.gYtd.gsLosses)
|
|
|
|
, " YTD ties: " ++ show (g^.gYtd.gsTies)
|
|
|
|
, " Lifetime games played: " ++ show (g^.gLifetime.gsGames)
|
|
|
|
, " Lifetime mins played: " ++ show (g^.gLifetime.gsMinsPlayed)
|
|
|
|
, "Lifetime goals allowed: " ++ show (g^.gLifetime.gsGoalsAllowed)
|
|
|
|
, " Lifetime wins: " ++ show (g^.gLifetime.gsWins)
|
|
|
|
, " Lifetime losses: " ++ show (g^.gLifetime.gsLosses)
|
|
|
|
, " Lifetime ties: " ++ show (g^.gLifetime.gsTies)
|
|
|
|
, ""
|
|
|
|
]
|