Fix bad find & replace

This commit is contained in:
Daniel García Aubert 2017-09-05 11:26:27 +02:00
parent 00741bc0a4
commit 37b1376767

View File

@ -11,40 +11,40 @@ const dateIntervalQueryTpl = ctx => `
WITH WITH
__cdb_dates AS ( __cdb_dates AS (
SELECT SELECT
MAX(${ctx.column}::timestamp) AS __cdb_end MAX(${ctx.column}::timestamp) AS __cdb_end,
MIN(${ctx.column}::timestamp) AS __cdb_start MIN(${ctx.column}::timestamp) AS __cdb_start
FROM (${ctx.query}) __cdb_source FROM (${ctx.query}) __cdb_source
), ),
__cdb_interval_in_days AS ( __cdb_interval_in_days AS (
SELECT SELECT
DATE_PART(\day\ __cdb_end - __cdb_start) AS __cdb_days DATE_PART('day', __cdb_end - __cdb_start) AS __cdb_days
FROM __cdb_dates FROM __cdb_dates
), ),
__cdb_interval_in_hours AS ( __cdb_interval_in_hours AS (
SELECT SELECT
__cdb_days * 24 + DATE_PART(\hour\ __cdb_end - __cdb_start) AS __cdb_hours __cdb_days * 24 + DATE_PART('hour', __cdb_end - __cdb_start) AS __cdb_hours
FROM __cdb_interval_in_days __cdb_dates FROM __cdb_interval_in_days, __cdb_dates
), ),
__cdb_interval_in_minutes AS ( __cdb_interval_in_minutes AS (
SELECT SELECT
__cdb_hours * 60 + DATE_PART(\minute\ __cdb_end - __cdb_start) AS __cdb_minutes __cdb_hours * 60 + DATE_PART('minute', __cdb_end - __cdb_start) AS __cdb_minutes
FROM __cdb_interval_in_hours __cdb_dates FROM __cdb_interval_in_hours, __cdb_dates
), ),
__cdb_interval_in_seconds AS ( __cdb_interval_in_seconds AS (
SELECT SELECT
__cdb_minutes * 60 + DATE_PART(\second\ __cdb_end - __cdb_start) AS __cdb_seconds __cdb_minutes * 60 + DATE_PART('second', __cdb_end - __cdb_start) AS __cdb_seconds
FROM __cdb_interval_in_minutes __cdb_dates FROM __cdb_interval_in_minutes, __cdb_dates
), )
SELECT SELECT
ROUND(__cdb_days / 365) AS year ROUND(__cdb_days / 365) AS year,
ROUND(__cdb_days / 90) AS quarter ROUND(__cdb_days / 90) AS quarter,
ROUND(__cdb_days / 30) AS month ROUND(__cdb_days / 30) AS month,
ROUND(__cdb_days / 7) AS week ROUND(__cdb_days / 7) AS week,
__cdb_days AS day __cdb_days AS day,
__cdb_hours AS hour __cdb_hours AS hour,
__cdb_minutes AS minute __cdb_minutes AS minute,
__cdb_seconds AS second __cdb_seconds AS second
FROM __cdb_interval_in_days __cdb_interval_in_hours __cdb_interval_in_minutes __cdb_interval_in_seconds FROM __cdb_interval_in_days, __cdb_interval_in_hours, __cdb_interval_in_minutes, __cdb_interval_in_seconds
`; `;
var MAX_INTERVAL_VALUE = 366; var MAX_INTERVAL_VALUE = 366;