shortened goalie edit header
This commit is contained in:
@@ -27,6 +27,7 @@ import Data.Maybe (fromMaybe)
|
||||
import Lens.Micro ((^.))
|
||||
import UI.NCurses as C
|
||||
|
||||
import Mtlstats.Helpers.Goalie
|
||||
import Mtlstats.Menu
|
||||
import Mtlstats.Menu.EditGoalie
|
||||
import Mtlstats.Prompt
|
||||
@@ -118,20 +119,4 @@ header :: ProgState -> C.Update ()
|
||||
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)
|
||||
, ""
|
||||
]
|
||||
Just $ goalieDetails g ++ "\n"
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{- |
|
||||
|
||||
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/>.
|
||||
|
||||
-}
|
||||
|
||||
module Mtlstats.Helpers.Goalie (goalieDetails) where
|
||||
|
||||
import Lens.Micro ((^.))
|
||||
|
||||
import Mtlstats.Format
|
||||
import Mtlstats.Types
|
||||
|
||||
-- | Provides a detailed 'String' describing a 'Goalie'
|
||||
goalieDetails :: Goalie -> String
|
||||
goalieDetails g = let
|
||||
header = unlines $ labelTable
|
||||
[ ( "Number", show $ g^.gNumber )
|
||||
, ( "Name", g^.gName )
|
||||
]
|
||||
|
||||
body = unlines $ numTable ["YTD", "Lifetime"] $ map
|
||||
(\(label, lens) -> (label, [g^.gYtd.lens, g^.gLifetime.lens]))
|
||||
[ ( "Games played", gsGames )
|
||||
, ( "Mins played", gsMinsPlayed )
|
||||
, ( "Goals allowed", gsGoalsAllowed )
|
||||
, ( "Wins", gsWins )
|
||||
, ( "Losses", gsLosses )
|
||||
, ( "Ties", gsTies )
|
||||
]
|
||||
|
||||
in header ++ "\n" ++ body
|
||||
Reference in New Issue
Block a user