{"action":"opened","issue":{"url":"https://api.github.com/repos/annalexc/cheesy/issues/2","repository_url":"https://api.github.com/repos/annalexc/cheesy","labels_url":"https://api.github.com/repos/annalexc/cheesy/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/annalexc/cheesy/issues/2/comments","events_url":"https://api.github.com/repos/annalexc/cheesy/issues/2/events","html_url":"https://github.com/annalexc/cheesy/issues/2","id":157962653,"number":2,"title":"Issue with multiple callback functions. Last callback function not being invoked","user":{"login":"annalexc","id":17601330,"avatar_url":"https://avatars.githubusercontent.com/u/17601330?v=3","gravatar_id":"","url":"https://api.github.com/users/annalexc","html_url":"https://github.com/annalexc","followers_url":"https://api.github.com/users/annalexc/followers","following_url":"https://api.github.com/users/annalexc/following{/other_user}","gists_url":"https://api.github.com/users/annalexc/gists{/gist_id}","starred_url":"https://api.github.com/users/annalexc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/annalexc/subscriptions","organizations_url":"https://api.github.com/users/annalexc/orgs","repos_url":"https://api.github.com/users/annalexc/repos","events_url":"https://api.github.com/users/annalexc/events{/privacy}","received_events_url":"https://api.github.com/users/annalexc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-01T17:25:41Z","updated_at":"2016-06-01T17:25:41Z","closed_at":null,"body":"In app.js:\r\n```js\r\n$http.get(apiLinkBase+'feed?start_date=' + $scope.startDate + '&end_date=' + $scope.endDate + '&api_key=' + apiKey).success(function(response) {\r\n    $scope.asteroidData = response;\r\n    parseAsteroidData($scope.asteroidData, parseOrbitData, combineAsteroidOrbitData);\r\n    // Toggle Asteroid Display to true;\r\n    viewAsteroids = true;\r\n  });\r\n```\r\n\r\nparseAsteroidData:\r\n```js\r\nfunction parseAsteroidData(asteroidData, callback1, callback2){\r\n  callback1 = callback1 || function(){console.log(\"No callback.\");}\r\n  callback2 = callback2 || function(){console.log(\"No callback.\");}\r\n // SOME LOGIC\r\n  callback1(callback2);\r\n};\r\n```\r\nparseOrbitData:\r\n```js\r\n\r\nfunction parseOrbitData(callback){\r\n  callback = callback || function(){};\r\n  orbits = [];\r\n  // console.log(asteroids);\r\n  for(var i = 0; i < asteroids.length; i++){\r\n    getData(asteroids[i].api_link, function(response){\r\n      orbits.push({\r\n        neo_reference_id : response.neo_reference_id,\r\n        orbital_data : response.orbital_data});\r\n    });\r\n  };\r\n  callback();\r\n};\r\n```\r\n\r\n**combineAsteroidOrbitData (This is not getting invoked)**:\r\n```js\r\nfunction combineAsteroidOrbitData(asteroids, orbits){\r\n  for(var i = 0; i < orbits.length; i++){\r\n    console.log(\"I get into loop i\");\r\n    var neoId = orbits[i].neo_reference_id;\r\n    for(var j=0; j < asteroids.length; j++){\r\n      if(asteroids[j].neo_reference_id == neoId){\r\n        console.log(neoId, asteroids[j].neo_reference_id);\r\n        asteroids[j].orbital_data = orbits[i].orbital_data;\r\n      };\r\n    };\r\n  }; \r\n};\r\n```\r\n\r\n"}}
{"actor":{"display_login":"annalexc"}}