The formula widget wasn't using the no_filters query for checking column types

This commit is contained in:
Javier Goizueta
2017-06-23 18:59:51 +02:00
parent 166e29e8ce
commit b2f3735e95
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -41,7 +41,7 @@ var TYPE = 'formula';
}
}
*/
function Formula(query, options) {
function Formula(query, options, queries) {
if (!_.isString(options.operation)) {
throw new Error('Formula expects `operation` in widget options');
}
@@ -57,6 +57,7 @@ function Formula(query, options) {
BaseWidget.apply(this);
this.query = query;
this.queries = queries;
this.column = options.column || '1';
this.operation = options.operation;
this._isFloatColumn = null;
@@ -77,7 +78,7 @@ Formula.prototype.sql = function(psql, override, callback) {
if (this._isFloatColumn === null) {
this._isFloatColumn = false;
this.getColumnType(psql, this.column, this.query, function (err, type) {
this.getColumnType(psql, this.column, this.queries.no_filters, function (err, type) {
if (!err && !!type) {
self._isFloatColumn = type.float;
}
@@ -55,6 +55,7 @@ function Formula(query, options, queryRewriter, queryRewriteData, params, querie
this.column = options.column || '1';
this.operation = options.operation;
this._isFloatColumn = null;
this.queries = queries;
}
Formula.prototype = Object.create(BaseOverviewsDataview.prototype);
@@ -70,7 +71,7 @@ Formula.prototype.sql = function (psql, override, callback) {
// supported formula for use with overviews
if (this._isFloatColumn === null) {
this._isFloatColumn = false;
this.getColumnType(psql, this.column, this.query, function (err, type) {
this.getColumnType(psql, this.column, this.queries.no_filters, function (err, type) {
if (!err && !!type) {
self._isFloatColumn = type.float;
}