Last active
August 29, 2015 14:23
-
-
Save joshuacrowley/3604b7750ca9fbc54b6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addTiles : function(gameToken, playerToken, tiles){ | |
var unplayed = Tiles.find({ | |
"gameToken": gameToken, | |
tileState: "unplayed", | |
"owner": "none", | |
}).fetch(); | |
if (unplayed.length > 0){ | |
var selected = _.first(unplayed, tiles); | |
selected.forEach(function (tile) { | |
Tiles.update({_id : tile._id}, {$set: {owner: playerToken}}); | |
}); | |
console.log(selected.length + "given to " + playerToken); | |
}else{ | |
console.log("none left"); | |
}; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment