Move getAggregation function to a class method

This commit is contained in:
Daniel García Aubert 2017-09-06 13:52:02 +02:00
parent 1be66e1552
commit 96740b82ed

View File

@ -606,7 +606,7 @@ module.exports = class Histogram extends BaseWidget {
binsStart = populateBinStart(override, firstRow);
if (Number.isFinite(timestampStart)) {
aggregation = getAggregation(override, this.aggregation);
aggregation = this.getAggregation(override);
offset = getOffset(override, this.offset);
}
@ -650,6 +650,10 @@ module.exports = class Histogram extends BaseWidget {
_query: this.query
});
}
getAggregation (override) {
return override && override.aggregation ? override.aggregation : this.aggregation;
}
};
var DATE_AGGREGATIONS = {
@ -663,9 +667,6 @@ var DATE_AGGREGATIONS = {
'year': true
};
function getAggregation(override, aggregation) {
return override && override.aggregation ? override.aggregation : aggregation;
}
function getOffset(override, offset) {
if (override && override.offset) {