Merge pull request #45 from mtlstats/filter-game-stats
filter out players without points from game report
This commit is contained in:
commit
cb5f2d7d15
|
@ -3,6 +3,7 @@
|
||||||
## current
|
## current
|
||||||
- Bugfix: removed quotation marks from goalie names in report
|
- Bugfix: removed quotation marks from goalie names in report
|
||||||
- Allow lower case player names
|
- Allow lower case player names
|
||||||
|
- Don't show players without points in game report
|
||||||
|
|
||||||
## 0.7.0
|
## 0.7.0
|
||||||
- Shortened views to fit within 25 lines
|
- Shortened views to fit within 25 lines
|
||||||
|
|
|
@ -125,7 +125,9 @@ gameStatsReport width s = let
|
||||||
Just (g, stats))
|
Just (g, stats))
|
||||||
(M.toList $ gs^.gameGoalieStats)
|
(M.toList $ gs^.gameGoalieStats)
|
||||||
|
|
||||||
in playerReport width "GAME" playerStats
|
criteria (_, ps) = psPoints ps > 0
|
||||||
|
|
||||||
|
in filteredPlayerReport width "GAME" criteria playerStats
|
||||||
++ [""]
|
++ [""]
|
||||||
++ goalieReport width goalieStats
|
++ goalieReport width goalieStats
|
||||||
|
|
||||||
|
@ -167,8 +169,18 @@ gameDate gs = fromMaybe "" $ do
|
||||||
Just $ m ++ " " ++ d ++ " " ++ y
|
Just $ m ++ " " ++ d ++ " " ++ y
|
||||||
|
|
||||||
playerReport :: Int -> String -> [(Player, PlayerStats)] -> [String]
|
playerReport :: Int -> String -> [(Player, PlayerStats)] -> [String]
|
||||||
playerReport width label ps = let
|
playerReport width label ps =
|
||||||
|
filteredPlayerReport width label (const True) ps
|
||||||
|
|
||||||
|
filteredPlayerReport
|
||||||
|
:: Int
|
||||||
|
-> String
|
||||||
|
-> ((Player, PlayerStats) -> Bool)
|
||||||
|
-> [(Player, PlayerStats)]
|
||||||
|
-> [String]
|
||||||
|
filteredPlayerReport width label criteria ps = let
|
||||||
tStats = foldl addPlayerStats newPlayerStats $ map snd ps
|
tStats = foldl addPlayerStats newPlayerStats $ map snd ps
|
||||||
|
fps = filter criteria ps
|
||||||
|
|
||||||
rHeader =
|
rHeader =
|
||||||
[ centre width (label ++ " STATISTICS")
|
[ centre width (label ++ " STATISTICS")
|
||||||
|
@ -196,7 +208,7 @@ playerReport width label ps = let
|
||||||
[ CellText $ show (p^.pNumber) ++ " "
|
[ CellText $ show (p^.pNumber) ++ " "
|
||||||
, CellText $ p^.pName
|
, CellText $ p^.pName
|
||||||
] ++ statsCells stats)
|
] ++ statsCells stats)
|
||||||
ps
|
fps
|
||||||
|
|
||||||
separator = replicate 2 (CellText "") ++ replicate 4 (CellFill '-')
|
separator = replicate 2 (CellText "") ++ replicate 4 (CellFill '-')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user