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