removed (redundant) gsGoalsAgainst
This commit is contained in:
parent
6b30e27836
commit
a234d8e802
|
@ -94,7 +94,6 @@ module Mtlstats.Types (
|
|||
gsGames,
|
||||
gsMinsPlayed,
|
||||
gsGoalsAllowed,
|
||||
gsGoalsAgainst,
|
||||
gsWins,
|
||||
gsLosses,
|
||||
gsTies,
|
||||
|
@ -396,8 +395,6 @@ data GoalieStats = GoalieStats
|
|||
-- ^ The number of minutes played
|
||||
, _gsGoalsAllowed :: Int
|
||||
-- ^ The number of goals allowed
|
||||
, _gsGoalsAgainst :: Int
|
||||
-- ^ The number of goals against
|
||||
, _gsWins :: Int
|
||||
-- ^ The number of wins
|
||||
, _gsLosses :: Int
|
||||
|
@ -411,26 +408,23 @@ instance FromJSON GoalieStats where
|
|||
<$> v .: "games"
|
||||
<*> v .: "mins_played"
|
||||
<*> v .: "goals_allowed"
|
||||
<*> v .: "goals_against"
|
||||
<*> v .: "wins"
|
||||
<*> v .: "losses"
|
||||
<*> v .: "ties"
|
||||
|
||||
instance ToJSON GoalieStats where
|
||||
toJSON (GoalieStats g m al ag w l t) = object
|
||||
toJSON (GoalieStats g m a w l t) = object
|
||||
[ "games" .= g
|
||||
, "mins_played" .= m
|
||||
, "goals_allowed" .= al
|
||||
, "goals_against" .= ag
|
||||
, "goals_allowed" .= a
|
||||
, "wins" .= w
|
||||
, "losses" .= l
|
||||
, "ties" .= t
|
||||
]
|
||||
toEncoding (GoalieStats g m al ag w l t) = pairs $
|
||||
toEncoding (GoalieStats g m a w l t) = pairs $
|
||||
"games" .= g <>
|
||||
"mins_played" .= m <>
|
||||
"goals_allowed" .= al <>
|
||||
"goals_against" .= ag <>
|
||||
"goals_allowed" .= a <>
|
||||
"wins" .= w <>
|
||||
"losses" .= l <>
|
||||
"ties" .= t
|
||||
|
@ -603,7 +597,6 @@ newGoalieStats = GoalieStats
|
|||
{ _gsGames = 0
|
||||
, _gsMinsPlayed = 0
|
||||
, _gsGoalsAllowed = 0
|
||||
, _gsGoalsAgainst = 0
|
||||
, _gsWins = 0
|
||||
, _gsLosses = 0
|
||||
, _gsTies = 0
|
||||
|
|
|
@ -117,14 +117,12 @@ resetYtdSpec = describe "resetYtd" $
|
|||
ytd ^. gsGames `shouldBe` 0
|
||||
ytd ^. gsMinsPlayed `shouldBe` 0
|
||||
ytd ^. gsGoalsAllowed `shouldBe` 0
|
||||
ytd ^. gsGoalsAgainst `shouldBe` 0
|
||||
ytd ^. gsWins `shouldBe` 0
|
||||
ytd ^. gsLosses `shouldBe` 0
|
||||
ytd ^. gsTies `shouldBe` 0
|
||||
lt ^. gsGames `shouldNotBe` 0
|
||||
lt ^. gsMinsPlayed `shouldNotBe` 0
|
||||
lt ^. gsGoalsAllowed `shouldNotBe` 0
|
||||
lt ^. gsGoalsAgainst `shouldNotBe` 0
|
||||
lt ^. gsWins `shouldNotBe` 0
|
||||
lt ^. gsLosses `shouldNotBe` 0
|
||||
lt ^. gsTies `shouldNotBe` 0) $
|
||||
|
@ -647,7 +645,6 @@ makeGoalieStats = GoalieStats
|
|||
<*> makeNum
|
||||
<*> makeNum
|
||||
<*> makeNum
|
||||
<*> makeNum
|
||||
|
||||
makeNum :: IO Int
|
||||
makeNum = randomRIO (1, 10)
|
||||
|
|
|
@ -241,20 +241,18 @@ goalieStats n = newGoalieStats
|
|||
& gsGames .~ n
|
||||
& gsMinsPlayed .~ n + 1
|
||||
& gsGoalsAllowed .~ n + 2
|
||||
& gsGoalsAgainst .~ n + 3
|
||||
& gsWins .~ n + 4
|
||||
& gsLosses .~ n + 5
|
||||
& gsTies .~ n + 6
|
||||
& gsWins .~ n + 3
|
||||
& gsLosses .~ n + 4
|
||||
& gsTies .~ n + 5
|
||||
|
||||
goalieStatsJSON :: Int -> Value
|
||||
goalieStatsJSON n = Object $ HM.fromList
|
||||
[ ( "games", toJSON n )
|
||||
, ( "mins_played", toJSON $ n + 1 )
|
||||
, ( "goals_allowed", toJSON $ n + 2 )
|
||||
, ( "goals_against", toJSON $ n + 3 )
|
||||
, ( "wins", toJSON $ n + 4 )
|
||||
, ( "losses", toJSON $ n + 5 )
|
||||
, ( "ties", toJSON $ n + 6 )
|
||||
, ( "wins", toJSON $ n + 3 )
|
||||
, ( "losses", toJSON $ n + 4 )
|
||||
, ( "ties", toJSON $ n + 5 )
|
||||
]
|
||||
|
||||
gameStats :: Int -> GameStats
|
||||
|
|
Loading…
Reference in New Issue
Block a user