Merge pull request #69 from mtlstats/sort-goalies

sort goalies by number of minutes played
This commit is contained in:
Jonathan Lamothe 2020-01-31 21:59:48 -05:00 committed by GitHub
commit d94c6a588e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
## current
- Edit lifetime stats on new player/goalie creation
- Sort goalies by minutes played
## 0.11.0
- Added active flag to players/goalies

View File

@ -261,8 +261,10 @@ goalieReport width showTotals lineNumbers goalieData = let
then "GOALTENDING TOTALS"
else ""
goalieData' = sortGoalies goalieData
tData = foldl addGoalieStats newGoalieStats
$ map snd goalieData
$ map snd goalieData'
header =
[ CellText "NO."
@ -287,7 +289,7 @@ goalieReport width showTotals lineNumbers goalieData = let
[ CellText $ show (goalie^.gNumber) ++ " "
, CellText $ goalieName goalie
] ++ rowCells stats)
goalieData
goalieData'
separator
= replicate 2 (CellText "")
@ -309,6 +311,8 @@ goalieReport width showTotals lineNumbers goalieData = let
gameGoalieReport :: Int -> [(Goalie, GoalieStats)] -> [String]
gameGoalieReport width goalieData = let
goalieData' = sortGoalies goalieData
header =
[ CellText "NO."
, CellText "GOALTENDER"
@ -325,8 +329,12 @@ gameGoalieReport width goalieData = let
, CellText $ show $ stats^.gsGoalsAllowed
, CellText $ showFloating $ gsAverage stats
])
goalieData
goalieData'
in map (centre width)
$ complexTable ([right, left] ++ repeat right)
$ header : body
sortGoalies :: [(Goalie, GoalieStats)] -> [(Goalie, GoalieStats)]
sortGoalies = sortOn $ Down . \(g, gs) ->
(gs^.gsMinsPlayed, g^.gLifetime.gsMinsPlayed)