Use a set/dict for checking the existence
This commit is contained in:
parent
0d4ac64f00
commit
2772fc62d2
@ -20,7 +20,15 @@ function DataviewBackend(analysisBackend) {
|
|||||||
this.analysisBackend = analysisBackend;
|
this.analysisBackend = analysisBackend;
|
||||||
}
|
}
|
||||||
|
|
||||||
var DATE_AGGREGATIONS = ['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'];
|
var DATE_AGGREGATIONS = {
|
||||||
|
'minute': true,
|
||||||
|
'hour': true,
|
||||||
|
'day': true,
|
||||||
|
'week': true,
|
||||||
|
'month': true,
|
||||||
|
'quarter': true,
|
||||||
|
'year': true
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = DataviewBackend;
|
module.exports = DataviewBackend;
|
||||||
|
|
||||||
@ -108,7 +116,7 @@ function getOverrideParams(params, ownFilter) {
|
|||||||
{ownFilter: ownFilter}
|
{ownFilter: ownFilter}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (params.aggregation && DATE_AGGREGATIONS.indexOf(params.aggregation) !== -1) {
|
if (params.aggregation && DATE_AGGREGATIONS.hasOwnProperty(params.aggregation)) {
|
||||||
overrideParams.aggregation = params.aggregation;
|
overrideParams.aggregation = params.aggregation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user