Lint fixes

This commit is contained in:
Javier Goizueta
2018-10-06 18:26:43 +02:00
parent c0febf2fd1
commit 996d7fc90d
3 changed files with 9 additions and 5 deletions
@@ -204,10 +204,11 @@ function _columnStats(ctx, columns, dimensions) {
Object.keys(dimensionsInfo).forEach(name => {
// Temporalily place dimensions info in stats.columns.__dimensions
stats.__dimensions = stats.__dimensions || {};
stats.__dimensions[name] = stats.__dimensions[name] || Object.assign({}, dimensionsStats[name]);
stats.__dimensions[name] = stats.__dimensions[name] || Object.assign({}, dimensionsStats[name]);
let type = null;
columnAggregations(dimensionsInfo[name]).forEach(fn => {
type = type || fieldTypeSafe(ctx.dbConnection, res.fields.find(f => f.name === `${name}_${fn}`));
type = type ||
fieldTypeSafe(ctx.dbConnection, res.fields.find(f => f.name === `${name}_${fn}`));
stats.__dimensions[name][fn] = res.rows[0][`${name}_${fn}`];
});
stats.__dimensions[name].type = type;
@@ -173,13 +173,16 @@ const dimensionNamesAndExpressions = (ctx) => {
};
const dimensionNames = (ctx, table) => {
return sep(dimensionNamesAndExpressions(ctx).map(([dimensionName, _]) => {
return sep(dimensionNamesAndExpressions(ctx).map(([dimensionName]) => {
return table ? `${table}."${dimensionName}"` : `"${dimensionName}"`;
}));
};
const dimensionDefs = ctx => {
return sep(dimensionNamesAndExpressions(ctx).map(([dimensionName, expression]) => `${expression.sql} AS "${dimensionName}"`));
return sep(
dimensionNamesAndExpressions(ctx)
.map(([dimensionName, expression]) => `${expression.sql} AS "${dimensionName}"`)
);
};
const aggregateFilters = ctx => ctx.filters || {};
@@ -25,7 +25,7 @@ function timeExpression(t, tz) {
}
function epochWithDefaults(epoch) {
/* jshint maxcomplexity:8 */ // goddammit linter, I like this as is!!
/* jshint maxcomplexity:9 */ // goddammit linter, I like this as is!!
const format = /^(\d\d\d\d)(?:\-?(\d\d)(?:\-?(\d\d)(?:[T\s]?(\d\d)(?:(\d\d)(?:\:(\d\d))?)?)?)?)?$/;
const match = (epoch || '').match(format) || [];
const year = match[1] || '0001';