aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client/src/Client.elm2
-rw-r--r--client/src/Messages.elm6
-rw-r--r--server/lib/Cafp/Game.hs2
-rw-r--r--server/lib/Cafp/Messages.hs4
4 files changed, 7 insertions, 7 deletions
diff --git a/client/src/Client.elm b/client/src/Client.elm
index f15952e..7a6f333 100644
--- a/client/src/Client.elm
+++ b/client/src/Client.elm
@@ -122,7 +122,7 @@ viewTable game = case game.view.table of
] ++
List.indexedMap (\i proposal ->
let attrs =
- if i == myProposal then
+ if Just i == myProposal then
[Html.Attributes.class "mine"]
else if Just i == myVote || Just i == game.selectedVote then
[Html.Attributes.class "voted"]
diff --git a/client/src/Messages.elm b/client/src/Messages.elm
index a100dbf..434efb0 100644
--- a/client/src/Messages.elm
+++ b/client/src/Messages.elm
@@ -107,14 +107,14 @@ jsonEncVotedView val =
type TableView =
Proposing BlackCard (List WhiteCard)
- | Voting BlackCard (List (List WhiteCard)) Int (Maybe Int)
+ | Voting BlackCard (List (List WhiteCard)) (Maybe Int) (Maybe Int)
| Tally BlackCard (List VotedView)
jsonDecTableView : Json.Decode.Decoder ( TableView )
jsonDecTableView =
let jsonDecDictTableView = Dict.fromList
[ ("Proposing", Json.Decode.lazy (\_ -> Json.Decode.map2 Proposing (Json.Decode.index 0 (jsonDecBlackCard)) (Json.Decode.index 1 (Json.Decode.list (jsonDecWhiteCard)))))
- , ("Voting", Json.Decode.lazy (\_ -> Json.Decode.map4 Voting (Json.Decode.index 0 (jsonDecBlackCard)) (Json.Decode.index 1 (Json.Decode.list (Json.Decode.list (jsonDecWhiteCard)))) (Json.Decode.index 2 (Json.Decode.int)) (Json.Decode.index 3 (Json.Decode.maybe (Json.Decode.int)))))
+ , ("Voting", Json.Decode.lazy (\_ -> Json.Decode.map4 Voting (Json.Decode.index 0 (jsonDecBlackCard)) (Json.Decode.index 1 (Json.Decode.list (Json.Decode.list (jsonDecWhiteCard)))) (Json.Decode.index 2 (Json.Decode.maybe (Json.Decode.int))) (Json.Decode.index 3 (Json.Decode.maybe (Json.Decode.int)))))
, ("Tally", Json.Decode.lazy (\_ -> Json.Decode.map2 Tally (Json.Decode.index 0 (jsonDecBlackCard)) (Json.Decode.index 1 (Json.Decode.list (jsonDecVotedView)))))
]
in decodeSumObjectWithSingleField "TableView" jsonDecDictTableView
@@ -123,7 +123,7 @@ jsonEncTableView : TableView -> Value
jsonEncTableView val =
let keyval v = case v of
Proposing v1 v2 -> ("Proposing", encodeValue (Json.Encode.list identity [jsonEncBlackCard v1, (Json.Encode.list jsonEncWhiteCard) v2]))
- Voting v1 v2 v3 v4 -> ("Voting", encodeValue (Json.Encode.list identity [jsonEncBlackCard v1, (Json.Encode.list (Json.Encode.list jsonEncWhiteCard)) v2, Json.Encode.int v3, (maybeEncode (Json.Encode.int)) v4]))
+ Voting v1 v2 v3 v4 -> ("Voting", encodeValue (Json.Encode.list identity [jsonEncBlackCard v1, (Json.Encode.list (Json.Encode.list jsonEncWhiteCard)) v2, (maybeEncode (Json.Encode.int)) v3, (maybeEncode (Json.Encode.int)) v4]))
Tally v1 v2 -> ("Tally", encodeValue (Json.Encode.list identity [jsonEncBlackCard v1, (Json.Encode.list jsonEncVotedView) v2]))
in encodeSumObjectWithSingleField keyval val
diff --git a/server/lib/Cafp/Game.hs b/server/lib/Cafp/Game.hs
index c5bd461..4a7bc91 100644
--- a/server/lib/Cafp/Game.hs
+++ b/server/lib/Cafp/Game.hs
@@ -272,7 +272,7 @@ gameViewForPlayer self game =
TableVoting black shuffled votes -> Voting
black
(fst <$> shuffled)
- (fromMaybe 0 $ V.findIndex ((self `elem`) . snd) shuffled)
+ (V.findIndex ((self `elem`) . snd) shuffled)
(HMS.lookup self votes)
TableTally black voted -> Tally black voted in
GameView
diff --git a/server/lib/Cafp/Messages.hs b/server/lib/Cafp/Messages.hs
index 4e5123d..b572fb7 100644
--- a/server/lib/Cafp/Messages.hs
+++ b/server/lib/Cafp/Messages.hs
@@ -49,8 +49,8 @@ data TableView
| Voting
!BlackCard
!(Vector (Vector WhiteCard)) -- ^ Proposals to vote for
- !Int -- ^ My proposal
- !(Maybe Int) -- ^ My vote
+ !(Maybe Int) -- ^ My proposal
+ !(Maybe Int) -- ^ My vote
| Tally !BlackCard !(Vector VotedView)
deriving (Show)