implemented playerIsActive

This commit is contained in:
Jonathan Lamothe
2019-10-15 00:51:42 -04:00
parent 363d0cb2d3
commit d338930800
2 changed files with 32 additions and 0 deletions
+11
View File
@@ -133,6 +133,7 @@ module Mtlstats.Types (
playerSearchExact,
modifyPlayer,
playerSummary,
playerIsActive,
-- ** PlayerStats Helpers
psPoints,
addPlayerStats
@@ -736,6 +737,16 @@ playerSummary :: Player -> String
playerSummary p =
p^.pName ++ " (" ++ show (p^.pNumber) ++ ") " ++ p^.pPosition
-- | Determines whether or not a player has been active in the current
-- season/year
playerIsActive :: Player -> Bool
playerIsActive = do
stats <- (^.pYtd)
return
$ stats^.psGoals /= 0
|| stats^.psAssists /= 0
|| stats^.psPMin /= 0
-- | Calculates a player's points
psPoints :: PlayerStats -> Int
psPoints s = s^.psGoals + s^.psAssists