Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $scope.updateStats = function(quote) {
  2. $scope.statsBackend.findOne()
  3. .done(function(item)
  4. {
  5. //goes through each JSON obj in the main list
  6. for (var i = 0; i < item.list.length; i++) {
  7. //adds 1 to the played sound
  8. if (item.list[i].quote == quote) {
  9. item.list[i].plays += 1;
  10. //console.log(JSON.stringify(item.list[i].quote), JSON.stringify(item.list[i].plays));
  11. }
  12. }
  13. item.update()
  14. .done(function(result)
  15. {
  16. //console.log('Updating success');
  17. })
  18. .fail(function(err)
  19. {
  20. //console.log("Err#" + err.code +": " + err.message);
  21. });
  22. });
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement