mark inactive players in playerName
This commit is contained in:
parent
e38275aefe
commit
461fb5d942
|
@ -49,8 +49,12 @@ playerDetails p = unlines $ top ++ [""] ++ table
|
||||||
playerName :: Player -> String
|
playerName :: Player -> String
|
||||||
playerName p = let
|
playerName p = let
|
||||||
|
|
||||||
|
prefix = if p^.pActive
|
||||||
|
then ""
|
||||||
|
else "*"
|
||||||
|
|
||||||
suffix = if p^.pRookie
|
suffix = if p^.pRookie
|
||||||
then "*"
|
then "*"
|
||||||
else ""
|
else ""
|
||||||
|
|
||||||
in p^.pName ++ suffix
|
in prefix ++ p^.pName ++ suffix
|
||||||
|
|
|
@ -71,9 +71,13 @@ playerNameSpec = describe "playerName" $ mapM_
|
||||||
-- label, player, expected
|
-- label, player, expected
|
||||||
[ ( "rookie", rookie, "foo*" )
|
[ ( "rookie", rookie, "foo*" )
|
||||||
, ( "non-rookie", nonRookie, "foo" )
|
, ( "non-rookie", nonRookie, "foo" )
|
||||||
|
, ( "retired", retired, "*foo" )
|
||||||
]
|
]
|
||||||
|
|
||||||
where
|
where
|
||||||
rookie = player True
|
rookie = player True True
|
||||||
nonRookie = player False
|
nonRookie = player False True
|
||||||
player r = newPlayer 1 "foo" "centre" & pRookie .~ r
|
retired = player False False
|
||||||
|
player r a = newPlayer 1 "foo" "centre"
|
||||||
|
& pRookie .~ r
|
||||||
|
& pActive .~ a
|
||||||
|
|
Loading…
Reference in New Issue
Block a user