sort players in YTD/lifetime reports by points
This commit is contained in:
parent
38db3c8d8f
commit
f1227da9ca
|
@ -4,6 +4,7 @@
|
||||||
- Bugfix: Display lifetime stats in report, not YTD
|
- Bugfix: Display lifetime stats in report, not YTD
|
||||||
- Force expected capitalization on player/goalie names
|
- Force expected capitalization on player/goalie names
|
||||||
- Don't show lifetime totals in report
|
- Don't show lifetime totals in report
|
||||||
|
- Sort players in YTD and lifetime reports by points
|
||||||
|
|
||||||
## 0.8.0
|
## 0.8.0
|
||||||
- Bugfix: removed quotation marks from goalie names in report
|
- Bugfix: removed quotation marks from goalie names in report
|
||||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module Mtlstats.Report (report, gameDate) where
|
module Mtlstats.Report (report, gameDate) where
|
||||||
|
|
||||||
|
import Data.List (sortOn)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Maybe (fromMaybe, mapMaybe)
|
import Data.Maybe (fromMaybe, mapMaybe)
|
||||||
import Lens.Micro ((^.))
|
import Lens.Micro ((^.))
|
||||||
|
@ -135,7 +136,8 @@ yearToDateStatsReport :: Int -> ProgState -> [String]
|
||||||
yearToDateStatsReport width s = let
|
yearToDateStatsReport width s = let
|
||||||
db = s^.database
|
db = s^.database
|
||||||
|
|
||||||
playerStats = map (\p -> (p, p^.pYtd))
|
playerStats = sortOn (psPoints . snd)
|
||||||
|
$ map (\p -> (p, p^.pYtd))
|
||||||
$ filter playerIsActive
|
$ filter playerIsActive
|
||||||
$ db^.dbPlayers
|
$ db^.dbPlayers
|
||||||
|
|
||||||
|
@ -151,7 +153,8 @@ lifetimeStatsReport :: Int -> ProgState -> [String]
|
||||||
lifetimeStatsReport width s = let
|
lifetimeStatsReport width s = let
|
||||||
db = s^.database
|
db = s^.database
|
||||||
|
|
||||||
playerStats = map (\p -> (p, p^.pLifetime))
|
playerStats = sortOn (psPoints . snd)
|
||||||
|
$ map (\p -> (p, p^.pLifetime))
|
||||||
$ db^.dbPlayers
|
$ db^.dbPlayers
|
||||||
|
|
||||||
goalieStats = map (\g -> (g, g^.gLifetime))
|
goalieStats = map (\g -> (g, g^.gLifetime))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user