Widgets returning two results
This commit is contained in:
parent
663703abae
commit
7d230cc15d
@ -10,12 +10,15 @@ var lzmaWorker = new LZMA();
|
||||
// Whitelist query parameters and attach format
|
||||
var REQUEST_QUERY_PARAMS_WHITELIST = [
|
||||
'config',
|
||||
'filters',
|
||||
'bbox',
|
||||
'map_key',
|
||||
'api_key',
|
||||
'auth_token',
|
||||
'callback'
|
||||
'callback',
|
||||
// widgets & filters
|
||||
'filters',
|
||||
'bbox',
|
||||
'start',
|
||||
'end'
|
||||
];
|
||||
|
||||
function BaseController(authApi, pgConnection) {
|
||||
@ -193,7 +196,7 @@ BaseController.prototype.sendError = function(req, res, err, label) {
|
||||
|
||||
var statusCode = findStatusCode(err);
|
||||
|
||||
debug('[%s ERROR] -- %d: %s', label, statusCode, err);
|
||||
debug('[%s ERROR] -- %d: %s, %s', label, statusCode, err, err.stack);
|
||||
|
||||
// If a callback was requested, force status to 200
|
||||
if (req.query && req.query.callback) {
|
||||
|
@ -148,7 +148,7 @@ describe('widgets', function() {
|
||||
{name:"El Lacón"},
|
||||
{name:"El Pico"}
|
||||
];
|
||||
assert.deepEqual(JSON.parse(res.body).rows, expectedList);
|
||||
assert.deepEqual(JSON.parse(res.body).ownFilterOn.rows, expectedList);
|
||||
|
||||
done();
|
||||
});
|
||||
@ -182,7 +182,7 @@ describe('widgets', function() {
|
||||
}
|
||||
|
||||
var histogram = JSON.parse(res.body);
|
||||
assert.ok(histogram.bins.length);
|
||||
assert.ok(histogram.ownFilterOn.bins.length);
|
||||
|
||||
done();
|
||||
});
|
||||
@ -221,8 +221,8 @@ describe('widgets', function() {
|
||||
}
|
||||
|
||||
var aggregation = JSON.parse(res.body);
|
||||
assert.equal(aggregation.categories.length, 223);
|
||||
assert.deepEqual(aggregation.categories[0], { count: 769, adm0_a3: 'USA' });
|
||||
assert.equal(aggregation.ownFilterOn.categories.length, 223);
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], { count: 769, adm0_a3: 'USA' });
|
||||
|
||||
done();
|
||||
});
|
||||
@ -242,8 +242,8 @@ describe('widgets', function() {
|
||||
}
|
||||
|
||||
var aggregation = JSON.parse(res.body);
|
||||
assert.equal(aggregation.categories.length, 1);
|
||||
assert.deepEqual(aggregation.categories[0], { count: 256, adm0_a3: 'CAN' });
|
||||
assert.equal(aggregation.ownFilterOn.categories.length, 1);
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], { count: 256, adm0_a3: 'CAN' });
|
||||
|
||||
done();
|
||||
});
|
||||
@ -281,7 +281,10 @@ describe('widgets', function() {
|
||||
|
||||
var histogram = JSON.parse(res.body);
|
||||
// notice min value
|
||||
assert.deepEqual(histogram.bins[0], { bin: 0, min: 0, max: 3917000, freq: 7229 });
|
||||
assert.deepEqual(
|
||||
histogram.ownFilterOn.bins[0],
|
||||
{ bin:0, start:0, end:3567600, freq:7229, min:0, max:3917000 }
|
||||
);
|
||||
|
||||
done();
|
||||
});
|
||||
@ -304,7 +307,14 @@ describe('widgets', function() {
|
||||
|
||||
var histogram = JSON.parse(res.body);
|
||||
// notice min value
|
||||
assert.deepEqual(histogram.bins[0], { bin: 0, min: 4009000, max: 7297054, freq: 50 });
|
||||
assert.deepEqual(histogram.ownFilterOn.bins[0], {
|
||||
bin: 0,
|
||||
start: 4009000,
|
||||
end: 7175700,
|
||||
freq: 50,
|
||||
min: 4009000,
|
||||
max: 7297054
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
@ -359,10 +369,10 @@ describe('widgets', function() {
|
||||
var aggregation = JSON.parse(res.body);
|
||||
|
||||
// first one would be CHN if reject filter wasn't applied
|
||||
assert.deepEqual(aggregation.categories[0], {"count":769,"adm0_a3":"USA"});
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], {"count":769,"adm0_a3":"USA"});
|
||||
|
||||
// confirm 'CHN' was filtered out (reject)
|
||||
assert.equal(aggregation.categories.reduce(function(sum, row) {
|
||||
assert.equal(aggregation.ownFilterOn.categories.reduce(function(sum, row) {
|
||||
return sum + (row.adm0_a3 === 'CHN' ? 1 : 0);
|
||||
}, 0), 0);
|
||||
|
||||
@ -389,10 +399,10 @@ describe('widgets', function() {
|
||||
var aggregation = JSON.parse(res.body);
|
||||
|
||||
// first one would be CHN if reject filter wasn't applied
|
||||
assert.deepEqual(aggregation.categories[0], { count: 4, adm0_a3: 'IND' });
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], { count: 4, adm0_a3: 'IND' });
|
||||
|
||||
// confirm 'CHN' was filtered out (reject)
|
||||
assert.equal(aggregation.categories.reduce(function(sum, row) {
|
||||
assert.equal(aggregation.ownFilterOn.categories.reduce(function(sum, row) {
|
||||
return sum + (row.adm0_a3 === 'CHN' ? 1 : 0);
|
||||
}, 0), 0);
|
||||
|
||||
@ -419,10 +429,10 @@ describe('widgets', function() {
|
||||
var aggregation = JSON.parse(res.body);
|
||||
|
||||
// first one would be CHN if reject filter wasn't applied
|
||||
assert.deepEqual(aggregation.categories[0], {"count":96,"adm0_a3":"RUS"});
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], {"count":96,"adm0_a3":"RUS"});
|
||||
|
||||
// confirm 'CHN' was filtered out (reject)
|
||||
assert.equal(aggregation.categories.reduce(function(sum, row) {
|
||||
assert.equal(aggregation.ownFilterOn.categories.reduce(function(sum, row) {
|
||||
return sum + (row.adm0_a3 === 'CHN' ? 1 : 0);
|
||||
}, 0), 0);
|
||||
|
||||
@ -450,10 +460,10 @@ describe('widgets', function() {
|
||||
var aggregation = JSON.parse(res.body);
|
||||
|
||||
// first one would be CHN if reject filter wasn't applied
|
||||
assert.deepEqual(aggregation.categories[0], {"count":77,"adm0_a3":"TUR"});
|
||||
assert.deepEqual(aggregation.ownFilterOn.categories[0], {"count":77,"adm0_a3":"TUR"});
|
||||
|
||||
// confirm 'CHN' was filtered out (reject)
|
||||
assert.equal(aggregation.categories.reduce(function(sum, row) {
|
||||
assert.equal(aggregation.ownFilterOn.categories.reduce(function(sum, row) {
|
||||
return sum + (row.adm0_a3 === 'CHN' ? 1 : 0);
|
||||
}, 0), 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user