Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created October 9, 2013 21:01
Show Gist options
  • Save tleyden/6908316 to your computer and use it in GitHub Desktop.
Save tleyden/6908316 to your computer and use it in GitHub Desktop.
votes := &OutgoingVotes{}
votesId := fmt.Sprintf("vote:%s", game.user.Id)
err := game.db.Retrieve(votesId, votes)
if err != nil {
logg.LogTo("MAIN", "Unable to find existing vote doc: %v", votesId)
}
votes.Id = votesId
votes.Turn = game.gameState.Turn
votes.PieceId = validMove.PieceId
votes.TeamId = game.ourTeamId
votes.GameId = game.gameState.Number
// TODO: this is actually a bug, because if there is a
// double jump it will only send the first jump move
endLocation := validMove.Locations[0]
locations := []int{validMove.StartLocation, endLocation}
votes.Locations = locations
newId, newRevision, err := game.db.Insert(votes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment