added active field to Player and Goalie
This commit is contained in:
parent
dd6f604cd7
commit
e38275aefe
@ -107,6 +107,7 @@ module Mtlstats.Types (
|
|||||||
pName,
|
pName,
|
||||||
pPosition,
|
pPosition,
|
||||||
pRookie,
|
pRookie,
|
||||||
|
pActive,
|
||||||
pYtd,
|
pYtd,
|
||||||
pLifetime,
|
pLifetime,
|
||||||
-- ** PlayerStats Lenses
|
-- ** PlayerStats Lenses
|
||||||
@ -117,6 +118,7 @@ module Mtlstats.Types (
|
|||||||
gNumber,
|
gNumber,
|
||||||
gName,
|
gName,
|
||||||
gRookie,
|
gRookie,
|
||||||
|
gActive,
|
||||||
gYtd,
|
gYtd,
|
||||||
gLifetime,
|
gLifetime,
|
||||||
-- ** GoalieStats Lenses
|
-- ** GoalieStats Lenses
|
||||||
@ -411,6 +413,8 @@ data Player = Player
|
|||||||
-- ^ The player's position
|
-- ^ The player's position
|
||||||
, _pRookie :: Bool
|
, _pRookie :: Bool
|
||||||
-- ^ Indicates that the player is a rookie
|
-- ^ Indicates that the player is a rookie
|
||||||
|
, _pActive :: Bool
|
||||||
|
-- ^ Indicates that the player is active
|
||||||
, _pYtd :: PlayerStats
|
, _pYtd :: PlayerStats
|
||||||
-- ^ The Player's year-to-date stats
|
-- ^ The Player's year-to-date stats
|
||||||
, _pLifetime :: PlayerStats
|
, _pLifetime :: PlayerStats
|
||||||
@ -435,6 +439,8 @@ data Goalie = Goalie
|
|||||||
-- ^ The goalie's name
|
-- ^ The goalie's name
|
||||||
, _gRookie :: Bool
|
, _gRookie :: Bool
|
||||||
-- ^ Indicates that the goalie is a rookie
|
-- ^ Indicates that the goalie is a rookie
|
||||||
|
, _gActive :: Bool
|
||||||
|
-- ^ Indicates that the goalie is active
|
||||||
, _gYtd :: GoalieStats
|
, _gYtd :: GoalieStats
|
||||||
-- ^ The goalie's year-to-date stats
|
-- ^ The goalie's year-to-date stats
|
||||||
, _gLifetime :: GoalieStats
|
, _gLifetime :: GoalieStats
|
||||||
@ -555,23 +561,26 @@ instance FromJSON Player where
|
|||||||
<*> v .: "name"
|
<*> v .: "name"
|
||||||
<*> v .: "position"
|
<*> v .: "position"
|
||||||
<*> v .:? "rookie" .!= False
|
<*> v .:? "rookie" .!= False
|
||||||
|
<*> v .:? "active" .!= True
|
||||||
<*> v .:? "ytd" .!= newPlayerStats
|
<*> v .:? "ytd" .!= newPlayerStats
|
||||||
<*> v .:? "lifetime" .!= newPlayerStats
|
<*> v .:? "lifetime" .!= newPlayerStats
|
||||||
|
|
||||||
instance ToJSON Player where
|
instance ToJSON Player where
|
||||||
toJSON (Player num name pos rk ytd lt) = object
|
toJSON (Player num name pos rk act ytd lt) = object
|
||||||
[ "number" .= num
|
[ "number" .= num
|
||||||
, "name" .= name
|
, "name" .= name
|
||||||
, "position" .= pos
|
, "position" .= pos
|
||||||
, "rookie" .= rk
|
, "rookie" .= rk
|
||||||
|
, "active" .= act
|
||||||
, "ytd" .= ytd
|
, "ytd" .= ytd
|
||||||
, "lifetime" .= lt
|
, "lifetime" .= lt
|
||||||
]
|
]
|
||||||
toEncoding (Player num name pos rk ytd lt) = pairs $
|
toEncoding (Player num name pos rk act ytd lt) = pairs $
|
||||||
"number" .= num <>
|
"number" .= num <>
|
||||||
"name" .= name <>
|
"name" .= name <>
|
||||||
"position" .= pos <>
|
"position" .= pos <>
|
||||||
"rookie" .= rk <>
|
"rookie" .= rk <>
|
||||||
|
"active" .= act <>
|
||||||
"ytd" .= ytd <>
|
"ytd" .= ytd <>
|
||||||
"lifetime" .= lt
|
"lifetime" .= lt
|
||||||
|
|
||||||
@ -597,21 +606,24 @@ instance FromJSON Goalie where
|
|||||||
<$> v .: "number"
|
<$> v .: "number"
|
||||||
<*> v .: "name"
|
<*> v .: "name"
|
||||||
<*> v .:? "rookie" .!= False
|
<*> v .:? "rookie" .!= False
|
||||||
|
<*> v .:? "active" .!= True
|
||||||
<*> v .:? "ytd" .!= newGoalieStats
|
<*> v .:? "ytd" .!= newGoalieStats
|
||||||
<*> v .:? "lifetime" .!= newGoalieStats
|
<*> v .:? "lifetime" .!= newGoalieStats
|
||||||
|
|
||||||
instance ToJSON Goalie where
|
instance ToJSON Goalie where
|
||||||
toJSON (Goalie num name rk ytd lt) = object
|
toJSON (Goalie num name rk act ytd lt) = object
|
||||||
[ "number" .= num
|
[ "number" .= num
|
||||||
, "name" .= name
|
, "name" .= name
|
||||||
, "ytd" .= ytd
|
, "ytd" .= ytd
|
||||||
, "rookie" .= rk
|
, "rookie" .= rk
|
||||||
|
, "active" .= act
|
||||||
, "lifetime" .= lt
|
, "lifetime" .= lt
|
||||||
]
|
]
|
||||||
toEncoding (Goalie num name rk ytd lt) = pairs $
|
toEncoding (Goalie num name rk act ytd lt) = pairs $
|
||||||
"number" .= num <>
|
"number" .= num <>
|
||||||
"name" .= name <>
|
"name" .= name <>
|
||||||
"rookie" .= rk <>
|
"rookie" .= rk <>
|
||||||
|
"active" .= act <>
|
||||||
"ytd" .= ytd <>
|
"ytd" .= ytd <>
|
||||||
"lifetime" .= lt
|
"lifetime" .= lt
|
||||||
|
|
||||||
@ -795,6 +807,7 @@ newPlayer num name pos = Player
|
|||||||
, _pName = name
|
, _pName = name
|
||||||
, _pPosition = pos
|
, _pPosition = pos
|
||||||
, _pRookie = True
|
, _pRookie = True
|
||||||
|
, _pActive = True
|
||||||
, _pYtd = newPlayerStats
|
, _pYtd = newPlayerStats
|
||||||
, _pLifetime = newPlayerStats
|
, _pLifetime = newPlayerStats
|
||||||
}
|
}
|
||||||
@ -818,6 +831,7 @@ newGoalie num name = Goalie
|
|||||||
{ _gNumber = num
|
{ _gNumber = num
|
||||||
, _gName = name
|
, _gName = name
|
||||||
, _gRookie = True
|
, _gRookie = True
|
||||||
|
, _gActive = True
|
||||||
, _gYtd = newGoalieStats
|
, _gYtd = newGoalieStats
|
||||||
, _gLifetime = newGoalieStats
|
, _gLifetime = newGoalieStats
|
||||||
}
|
}
|
||||||
|
@ -848,6 +848,7 @@ makePlayer = Player
|
|||||||
<*> makeName
|
<*> makeName
|
||||||
<*> makeName
|
<*> makeName
|
||||||
<*> makeBool
|
<*> makeBool
|
||||||
|
<*> makeBool
|
||||||
<*> makePlayerStats
|
<*> makePlayerStats
|
||||||
<*> makePlayerStats
|
<*> makePlayerStats
|
||||||
|
|
||||||
@ -857,6 +858,7 @@ makeGoalie = Goalie
|
|||||||
<$> makeNum
|
<$> makeNum
|
||||||
<*> makeName
|
<*> makeName
|
||||||
<*> makeBool
|
<*> makeBool
|
||||||
|
<*> makeBool
|
||||||
<*> makeGoalieStats
|
<*> makeGoalieStats
|
||||||
<*> makeGoalieStats
|
<*> makeGoalieStats
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user