If we have the stats FF disbabled return empty array instead of null
But we keep checking for elements in the returned object because we don't want to include the stats property if the FF is disabled
This commit is contained in:
@@ -11,6 +11,6 @@ StatsBackend.prototype.getStats = function(mapConfig, dbConnection, callback) {
|
||||
if (layerStatsEnabled) {
|
||||
layerStats().getStats(mapConfig, dbConnection, callback);
|
||||
} else {
|
||||
return callback(null, null);
|
||||
return callback(null, []);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -368,7 +368,7 @@ function(req, res, mapconfig, layergroup, analysesResults, callback) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (layersStats) {
|
||||
if (layersStats.length > 0) {
|
||||
layergroup.metadata.layers.forEach(function (layer, index) {
|
||||
layer.meta.stats = layersStats[index];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user