diff --git a/controllers/resources.js b/controllers/resources.js index 84dc9913bf..28d432eefa 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -104,12 +104,12 @@ module.exports = { var daysRunning = Math.ceil(timeDiff / (1000 * 3600 * 24)); var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 }; client.get('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(trello, res2) { - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls', githubHeaders, function(pulls, res3) { - client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues', githubHeaders, function(issues, res4) { - client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + client.get('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (blogger, res5) { + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(pulls, res3) { + pulls = Object.keys(JSON.parse(pulls)).length || "Can't connect to github"; + client.get('https://api.github.com/repos/freecodecamp/freecodecamp/issues?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(issues, res4) { var nonprofitProjects = (JSON.parse(trello)).length || 27; - var pulls = pulls ? (JSON.parse(pulls)).length : 0; - var issues = issues ? (JSON.parse(issues)).length : 0; + issues = Object.keys(JSON.parse(issues)).length - pulls || "Can't connect to github"; var blog = JSON.parse(blogger); User.count({'points': {'$gt': 2}}, function (err, c3) { if (err) { diff --git a/views/partials/stats.jade b/views/partials/stats.jade index 7cebe88e30..266366c25b 100644 --- a/views/partials/stats.jade +++ b/views/partials/stats.jade @@ -9,7 +9,7 @@ h2.stats-text a(href="https://trello.com/b/BA3xVpz9/nonprofit-projects") (view) .row .col-xs-6.text-right Open Issues: - .col-xs-6.text-left= pulls + .col-xs-6.text-left= issues |   a(href="https://github.com/freecodecamp/freecodecamp/issues") (view) .row