From 03ba225587777864bc9a897fdd1bb4c1c1f39c9e Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 19 Apr 2023 21:16:56 -0700 Subject: [PATCH] More resetDate conversion. --- queries/analytics/event/getEventMetrics.ts | 4 ++-- queries/analytics/eventData/getEventData.ts | 4 ++-- queries/analytics/pageview/getPageviewMetrics.ts | 4 ++-- queries/analytics/pageview/getPageviewStats.ts | 4 ++-- queries/analytics/session/getSessionMetrics.ts | 4 ++-- queries/analytics/stats/getWebsiteStats.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/queries/analytics/event/getEventMetrics.ts b/queries/analytics/event/getEventMetrics.ts index 32deef5d..32c4c3d0 100644 --- a/queries/analytics/event/getEventMetrics.ts +++ b/queries/analytics/event/getEventMetrics.ts @@ -47,7 +47,7 @@ async function relationalQuery( ) { const { toUuid, rawQuery, getDateQuery, getFilterQuery } = prisma; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params: any = [websiteId, resetDate, startDate, endDate]; const filterQuery = getFilterQuery(filters, params); @@ -89,7 +89,7 @@ async function clickhouseQuery( ) { const { rawQuery, getDateQuery, getDateFormat, getBetweenDates, getFilterQuery } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId }; return rawQuery( diff --git a/queries/analytics/eventData/getEventData.ts b/queries/analytics/eventData/getEventData.ts index 5b72b111..73a71386 100644 --- a/queries/analytics/eventData/getEventData.ts +++ b/queries/analytics/eventData/getEventData.ts @@ -49,7 +49,7 @@ async function relationalQuery( const { startDate, endDate, timeSeries, eventName, urlPath, filters } = data; const { toUuid, rawQuery, getEventDataFilterQuery, getDateQuery } = prisma; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params: any = [websiteId, resetDate, startDate, endDate, eventName || '']; return rawQuery( @@ -99,7 +99,7 @@ async function clickhouseQuery( const { rawQuery, getDateFormat, getBetweenDates, getDateQuery, getEventDataFilterQuery } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId }; return rawQuery( diff --git a/queries/analytics/pageview/getPageviewMetrics.ts b/queries/analytics/pageview/getPageviewMetrics.ts index 8f1b6ca7..db82720d 100644 --- a/queries/analytics/pageview/getPageviewMetrics.ts +++ b/queries/analytics/pageview/getPageviewMetrics.ts @@ -33,7 +33,7 @@ async function relationalQuery( const { startDate, endDate, filters = {}, column } = criteria; const { rawQuery, parseFilters, toUuid } = prisma; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params: any = [ websiteId, resetDate, @@ -80,7 +80,7 @@ async function clickhouseQuery( const { startDate, endDate, filters = {}, column } = criteria; const { rawQuery, getDateFormat, parseFilters, getBetweenDates } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId, eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView, diff --git a/queries/analytics/pageview/getPageviewStats.ts b/queries/analytics/pageview/getPageviewStats.ts index 275af58b..01e4ab14 100644 --- a/queries/analytics/pageview/getPageviewStats.ts +++ b/queries/analytics/pageview/getPageviewStats.ts @@ -47,7 +47,7 @@ async function relationalQuery( } = criteria; const { toUuid, getDateQuery, parseFilters, rawQuery } = prisma; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params: any = [websiteId, resetDate, startDate, endDate]; const { filterQuery, joinSession } = parseFilters(filters, params); @@ -95,7 +95,7 @@ async function clickhouseQuery( getBetweenDates, } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId }; const { filterQuery } = parseFilters(filters, params); diff --git a/queries/analytics/session/getSessionMetrics.ts b/queries/analytics/session/getSessionMetrics.ts index bfd96e8f..57d4a736 100644 --- a/queries/analytics/session/getSessionMetrics.ts +++ b/queries/analytics/session/getSessionMetrics.ts @@ -21,7 +21,7 @@ async function relationalQuery( criteria: { startDate: Date; endDate: Date; column: string; filters: object }, ) { const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const { startDate, endDate, column, filters = {} } = criteria; const { toUuid, parseFilters, rawQuery } = prisma; const params: any = [websiteId, resetDate, startDate, endDate]; @@ -55,7 +55,7 @@ async function clickhouseQuery( const { startDate, endDate, column, filters = {} } = data; const { getDateFormat, parseFilters, getBetweenDates, rawQuery } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId }; const { filterQuery } = parseFilters(filters, params); diff --git a/queries/analytics/stats/getWebsiteStats.ts b/queries/analytics/stats/getWebsiteStats.ts index bc95eda3..0021e793 100644 --- a/queries/analytics/stats/getWebsiteStats.ts +++ b/queries/analytics/stats/getWebsiteStats.ts @@ -59,7 +59,7 @@ async function clickhouseQuery( const { startDate, endDate, filters = {} } = criteria; const { rawQuery, getDateFormat, getDateQuery, getBetweenDates, parseFilters } = clickhouse; const website = await loadWebsite(websiteId); - const resetDate = website?.resetAt || website?.createdAt; + const resetDate = new Date(website?.resetAt || website?.createdAt); const params = { websiteId }; const { filterQuery } = parseFilters(filters, params);