Skip to content

Commit

Permalink
Fix error on co2
Browse files Browse the repository at this point in the history
  • Loading branch information
corradio committed Nov 22, 2016
1 parent 3877111 commit d1d24ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function computeCo2(countries, exchanges) {
});
d3.values(exchanges).forEach(function(exchange) {
exchange.co2intensity = countries[exchange.countryCodes[exchange.netFlow > 0 ? 0 : 1]].co2intensity;
})
});
}
function elementQuery(keyName, keyValue, minDate, maxDate) {
var query = { datetime: rangeQuery(minDate, maxDate) };
Expand Down Expand Up @@ -238,7 +238,9 @@ app.get('/v1/co2', function(req, res) {
var t0 = new Date().getTime();
var countryCode = req.query.countryCode;

function onCo2Computed(err, countries) {
// TODO: Rewrite this api with two promises [geocoder, state]
function onCo2Computed(err, obj) {
var countries = obj.countries;
if (err) {
statsdClient.increment('co2_GET_ERROR');
console.error(err);
Expand Down

0 comments on commit d1d24ac

Please sign in to comment.