Avoid nested ternaries
This commit is contained in:
@@ -112,7 +112,7 @@ const binsQueryTpl = ctx => `
|
||||
|
||||
const overrideBinsQueryTpl = ctx => `
|
||||
__cdb_bins AS (
|
||||
SELECT ${ctx._bins} AS __cdb_bins_number
|
||||
SELECT ${ctx._override.bins} AS __cdb_bins_number
|
||||
)
|
||||
`;
|
||||
|
||||
@@ -380,7 +380,6 @@ module.exports = class Histogram extends BaseDataview {
|
||||
_end: this.getBinEnd(override),
|
||||
_minBins: BIN_MIN_NUMBER,
|
||||
_maxBins: BIN_MAX_NUMBER,
|
||||
_bins: override.bins
|
||||
});
|
||||
|
||||
debug(histogramSql);
|
||||
@@ -393,11 +392,9 @@ module.exports = class Histogram extends BaseDataview {
|
||||
WITH
|
||||
${filteredQueryTpl(ctx)},
|
||||
${this._shouldOverride(ctx._override) ? overrideBasicsQueryTpl(ctx) : basicsQueryTpl(ctx)},
|
||||
${this._shouldOverride(ctx._override) ?
|
||||
${this._shouldOverride(ctx._override) || this._shouldOverrideBins(ctx._override) ?
|
||||
overrideBinsQueryTpl(ctx) :
|
||||
this._shouldOverrideBins(ctx._override) ?
|
||||
overrideBinsQueryTpl(ctx) :
|
||||
`${iqrQueryTpl(ctx)}, ${binsQueryTpl(ctx)}`
|
||||
`${iqrQueryTpl(ctx)}, ${binsQueryTpl(ctx)}`
|
||||
},
|
||||
${nullsQueryTpl(ctx)}
|
||||
${ctx._isFloatColumn ? `,${infinitiesQueryTpl(ctx)}, ${nansQueryTpl(ctx)}` : ''}
|
||||
|
||||
Reference in New Issue
Block a user