Merge pull request #69 from mtlstats/sort-goalies
sort goalies by number of minutes played
This commit is contained in:
commit
d94c6a588e
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## current
|
## current
|
||||||
- Edit lifetime stats on new player/goalie creation
|
- Edit lifetime stats on new player/goalie creation
|
||||||
|
- Sort goalies by minutes played
|
||||||
|
|
||||||
## 0.11.0
|
## 0.11.0
|
||||||
- Added active flag to players/goalies
|
- Added active flag to players/goalies
|
||||||
|
|
|
@ -261,8 +261,10 @@ goalieReport width showTotals lineNumbers goalieData = let
|
||||||
then "GOALTENDING TOTALS"
|
then "GOALTENDING TOTALS"
|
||||||
else ""
|
else ""
|
||||||
|
|
||||||
|
goalieData' = sortGoalies goalieData
|
||||||
|
|
||||||
tData = foldl addGoalieStats newGoalieStats
|
tData = foldl addGoalieStats newGoalieStats
|
||||||
$ map snd goalieData
|
$ map snd goalieData'
|
||||||
|
|
||||||
header =
|
header =
|
||||||
[ CellText "NO."
|
[ CellText "NO."
|
||||||
|
@ -287,7 +289,7 @@ goalieReport width showTotals lineNumbers goalieData = let
|
||||||
[ CellText $ show (goalie^.gNumber) ++ " "
|
[ CellText $ show (goalie^.gNumber) ++ " "
|
||||||
, CellText $ goalieName goalie
|
, CellText $ goalieName goalie
|
||||||
] ++ rowCells stats)
|
] ++ rowCells stats)
|
||||||
goalieData
|
goalieData'
|
||||||
|
|
||||||
separator
|
separator
|
||||||
= replicate 2 (CellText "")
|
= replicate 2 (CellText "")
|
||||||
|
@ -309,6 +311,8 @@ goalieReport width showTotals lineNumbers goalieData = let
|
||||||
|
|
||||||
gameGoalieReport :: Int -> [(Goalie, GoalieStats)] -> [String]
|
gameGoalieReport :: Int -> [(Goalie, GoalieStats)] -> [String]
|
||||||
gameGoalieReport width goalieData = let
|
gameGoalieReport width goalieData = let
|
||||||
|
goalieData' = sortGoalies goalieData
|
||||||
|
|
||||||
header =
|
header =
|
||||||
[ CellText "NO."
|
[ CellText "NO."
|
||||||
, CellText "GOALTENDER"
|
, CellText "GOALTENDER"
|
||||||
|
@ -325,8 +329,12 @@ gameGoalieReport width goalieData = let
|
||||||
, CellText $ show $ stats^.gsGoalsAllowed
|
, CellText $ show $ stats^.gsGoalsAllowed
|
||||||
, CellText $ showFloating $ gsAverage stats
|
, CellText $ showFloating $ gsAverage stats
|
||||||
])
|
])
|
||||||
goalieData
|
goalieData'
|
||||||
|
|
||||||
in map (centre width)
|
in map (centre width)
|
||||||
$ complexTable ([right, left] ++ repeat right)
|
$ complexTable ([right, left] ++ repeat right)
|
||||||
$ header : body
|
$ header : body
|
||||||
|
|
||||||
|
sortGoalies :: [(Goalie, GoalieStats)] -> [(Goalie, GoalieStats)]
|
||||||
|
sortGoalies = sortOn $ Down . \(g, gs) ->
|
||||||
|
(gs^.gsMinsPlayed, g^.gLifetime.gsMinsPlayed)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user