diff --git a/lib/cartodb/models/dataview/formula.js b/lib/cartodb/models/dataview/formula.js index b6faeb55..b167b87e 100644 --- a/lib/cartodb/models/dataview/formula.js +++ b/lib/cartodb/models/dataview/formula.js @@ -53,6 +53,16 @@ module.exports = class Formula extends BaseDataview { constructor (query, options = {}, queries = {}) { super(); + this._checkOptions(options); + + this.query = query; + this.queries = queries; + this.column = options.column || '1'; + this.operation = options.operation; + this._isFloatColumn = null; + } + + _checkOptions (options) { if (typeof options.operation !== 'string') { throw new Error(`Formula expects 'operation' in dataview options`); } @@ -64,12 +74,6 @@ module.exports = class Formula extends BaseDataview { if (options.operation !== 'count' && typeof options.column !== 'string') { throw new Error(`Formula expects 'column' in dataview options`); } - - this.query = query; - this.queries = queries; - this.column = options.column || '1'; - this.operation = options.operation; - this._isFloatColumn = null; }