Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.updateStats = function(quote) {
- $scope.statsBackend.findOne()
- .done(function(item)
- {
- //goes through each JSON obj in the main list
- for (var i = 0; i < item.list.length; i++) {
- //adds 1 to the played sound
- if (item.list[i].quote == quote) {
- item.list[i].plays += 1;
- //console.log(JSON.stringify(item.list[i].quote), JSON.stringify(item.list[i].plays));
- }
- }
- item.update()
- .done(function(result)
- {
- //console.log('Updating success');
- })
- .fail(function(err)
- {
- //console.log("Err#" + err.code +": " + err.message);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement