refactor in order not to tamper the dataview results data
This commit is contained in:
parent
8ef260972d
commit
732f891850
@ -59,17 +59,11 @@ DataviewBackend.prototype.getDataview = function (mapConfigProvider, user, param
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
dataview.getResult(pg, overrideParams, function (err, dataviewResult) {
|
||||
dataview.getResult(pg, overrideParams, function (err, dataviewResult, stats = {}) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
const stats = {};
|
||||
|
||||
if (dataviewResult && dataviewResult.usesOverviews) {
|
||||
stats.usesOverviews = dataviewResult.usesOverviews;
|
||||
}
|
||||
|
||||
return callback(null, dataviewResult, stats);
|
||||
});
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ function getPGTypeName (pgType) {
|
||||
|
||||
module.exports = class BaseDataview {
|
||||
getResult (psql, override, callback) {
|
||||
this.sql(psql, override, (err, query, flags = { usesOverviews : false }) => {
|
||||
this.sql(psql, override, (err, query, flags = null) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@ -33,10 +33,15 @@ module.exports = class BaseDataview {
|
||||
|
||||
result = this.format(result, override);
|
||||
result.type = this.getType();
|
||||
result.usesOverviews = flags.usesOverviews;
|
||||
|
||||
return callback(null, result);
|
||||
|
||||
//Overviews looging
|
||||
const stats = {};
|
||||
|
||||
if (flags && flags.usesOverviews) {
|
||||
stats.usesOverviews = true;
|
||||
}
|
||||
|
||||
return callback(null, result, stats);
|
||||
}, true); // use read-only transaction
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user