Merge pull request #70 from mtlstats/sort-players
subsort players by lifetime points
This commit is contained in:
commit
607a78ccea
|
@ -3,6 +3,7 @@
|
|||
## current
|
||||
- Edit lifetime stats on new player/goalie creation
|
||||
- Sort goalies by minutes played
|
||||
- Subsort players by lifetime points
|
||||
|
||||
## 0.11.0
|
||||
- Added active flag to players/goalies
|
||||
|
|
|
@ -117,7 +117,7 @@ gameStatsReport width s = let
|
|||
gs = s^.progMode.gameStateL
|
||||
db = s^.database
|
||||
|
||||
playerStats = mapMaybe
|
||||
playerStats = sortPlayers $ mapMaybe
|
||||
(\(pid, stats) -> do
|
||||
p <- nth pid $ db^.dbPlayers
|
||||
Just (p, stats))
|
||||
|
@ -139,7 +139,7 @@ yearToDateStatsReport :: Int -> ProgState -> [String]
|
|||
yearToDateStatsReport width s = let
|
||||
db = s^.database
|
||||
|
||||
playerStats = sortOn (Down . psPoints . snd)
|
||||
playerStats = sortPlayers
|
||||
$ map (\p -> (p, p^.pYtd))
|
||||
$ filter playerIsActive
|
||||
$ db^.dbPlayers
|
||||
|
@ -156,7 +156,7 @@ lifetimeStatsReport :: Int -> ProgState -> [String]
|
|||
lifetimeStatsReport width s = let
|
||||
db = s^.database
|
||||
|
||||
playerStats = sortOn (Down . psPoints . snd)
|
||||
playerStats = sortPlayers
|
||||
$ map (\p -> (p, p^.pLifetime))
|
||||
$ db^.dbPlayers
|
||||
|
||||
|
@ -335,6 +335,10 @@ gameGoalieReport width goalieData = let
|
|||
$ complexTable ([right, left] ++ repeat right)
|
||||
$ header : body
|
||||
|
||||
sortPlayers :: [(Player, PlayerStats)] -> [(Player, PlayerStats)]
|
||||
sortPlayers = sortOn $ Down . \(p, ps) ->
|
||||
(psPoints ps, psPoints $ p^.pLifetime)
|
||||
|
||||
sortGoalies :: [(Goalie, GoalieStats)] -> [(Goalie, GoalieStats)]
|
||||
sortGoalies = sortOn $ Down . \(g, gs) ->
|
||||
(gs^.gsMinsPlayed, g^.gLifetime.gsMinsPlayed)
|
||||
|
|
Loading…
Reference in New Issue
Block a user