added EditPlayerMode
This commit is contained in:
parent
5fd67f3802
commit
c26c0f54d1
|
@ -32,6 +32,7 @@ module Mtlstats.Types (
|
||||||
CreatePlayerState (..),
|
CreatePlayerState (..),
|
||||||
CreateGoalieState (..),
|
CreateGoalieState (..),
|
||||||
EditPlayerState (..),
|
EditPlayerState (..),
|
||||||
|
EditPlayerMode (..),
|
||||||
Database (..),
|
Database (..),
|
||||||
Player (..),
|
Player (..),
|
||||||
PlayerStats (..),
|
PlayerStats (..),
|
||||||
|
@ -86,6 +87,7 @@ module Mtlstats.Types (
|
||||||
cgsFailureCallback,
|
cgsFailureCallback,
|
||||||
-- ** EditPlayerState Lenses
|
-- ** EditPlayerState Lenses
|
||||||
epsSelectedPlayer,
|
epsSelectedPlayer,
|
||||||
|
epsMode,
|
||||||
-- ** Database Lenses
|
-- ** Database Lenses
|
||||||
dbPlayers,
|
dbPlayers,
|
||||||
dbGoalies,
|
dbGoalies,
|
||||||
|
@ -306,11 +308,27 @@ data CreateGoalieState = CreateGoalieState
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | Player edit status
|
-- | Player edit status
|
||||||
newtype EditPlayerState = EditPlayerState
|
data EditPlayerState = EditPlayerState
|
||||||
{ _epsSelectedPlayer :: Maybe Int
|
{ _epsSelectedPlayer :: Maybe Int
|
||||||
-- ^ The index number of the player being edited
|
-- ^ The index number of the player being edited
|
||||||
|
, _epsMode :: EditPlayerMode
|
||||||
|
-- ^ The editing mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | Player editing mode
|
||||||
|
data EditPlayerMode
|
||||||
|
= EPMenu
|
||||||
|
| EPNumber
|
||||||
|
| EPName
|
||||||
|
| EPPosition
|
||||||
|
| EPYtdGoals
|
||||||
|
| EPYtdAssists
|
||||||
|
| EPYtdPMin
|
||||||
|
| EPLtGoals
|
||||||
|
| EPLtAssists
|
||||||
|
| EPLtPMin
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
||||||
-- | Represents the database
|
-- | Represents the database
|
||||||
data Database = Database
|
data Database = Database
|
||||||
{ _dbPlayers :: [Player]
|
{ _dbPlayers :: [Player]
|
||||||
|
@ -651,6 +669,7 @@ newCreateGoalieState = CreateGoalieState
|
||||||
newEditPlayerState :: EditPlayerState
|
newEditPlayerState :: EditPlayerState
|
||||||
newEditPlayerState = EditPlayerState
|
newEditPlayerState = EditPlayerState
|
||||||
{ _epsSelectedPlayer = Nothing
|
{ _epsSelectedPlayer = Nothing
|
||||||
|
, _epsMode = EPMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | Constructor for a 'Database'
|
-- | Constructor for a 'Database'
|
||||||
|
|
|
@ -754,11 +754,16 @@ instance Comparable CreatePlayerState where
|
||||||
actual^.cpsPosition `shouldBe` expected^.cpsPosition
|
actual^.cpsPosition `shouldBe` expected^.cpsPosition
|
||||||
|
|
||||||
instance Comparable EditPlayerState where
|
instance Comparable EditPlayerState where
|
||||||
compareTest actual expected =
|
compareTest actual expected = do
|
||||||
|
|
||||||
describe "epsSelectedPlayer" $
|
describe "epsSelectedPlayer" $
|
||||||
it ("should be " ++ show (expected^.epsSelectedPlayer)) $
|
it ("should be " ++ show (expected^.epsSelectedPlayer)) $
|
||||||
actual^.epsSelectedPlayer `shouldBe` expected^.epsSelectedPlayer
|
actual^.epsSelectedPlayer `shouldBe` expected^.epsSelectedPlayer
|
||||||
|
|
||||||
|
describe "epsMode" $
|
||||||
|
it ("should be " ++ show (expected^.epsMode)) $
|
||||||
|
actual^.epsMode `shouldBe` expected^.epsMode
|
||||||
|
|
||||||
instance Comparable CreateGoalieState where
|
instance Comparable CreateGoalieState where
|
||||||
compareTest actual expected = do
|
compareTest actual expected = do
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user