diff --git a/CHANGELOG.md b/CHANGELOG.md index 112fe16e..ecdda7cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Friday, April 11th, 2025 + +### Fixed + +- Fixed submission timestamp filter calculations for Looker dashboards so that any dates in the future won't be showing null data + ## Thursday, April 10th, 2025 ### Added diff --git a/__tests__/lib/lookerUtils.test.ts b/__tests__/lib/lookerUtils.test.ts index 8a7f3d3b..94e5d568 100644 --- a/__tests__/lib/lookerUtils.test.ts +++ b/__tests__/lib/lookerUtils.test.ts @@ -63,7 +63,7 @@ describe("getLookerSubmissionTimestampDateFilter", () => { const result = getLookerSubmissionTimestampDateFilter(startDate, endDate); - expect(result).toEqual("2024-05-08 to 3024-06-10"); + expect(result).toEqual("2024-05-08 to today"); }); it("returns a date filter from the startDate to endDate when startDate and endDate are defined and the message is completed", () => { diff --git a/__tests__/lib/messageUtils.test.ts b/__tests__/lib/messageUtils.test.ts index e407b948..054724a7 100644 --- a/__tests__/lib/messageUtils.test.ts +++ b/__tests__/lib/messageUtils.test.ts @@ -142,9 +142,10 @@ describe("getDashboard", () => { const template = "feature_callout"; const msgId = "a:bc"; // weird chars to test URI encoding const startDate = "2024-03-08"; - const endDate = "2025-06-28"; + const endDate = "3025-06-28"; const dashboardId = getDashboardIdForTemplate(template); - const submissionDate = "2024-03-08 to 2025-06-28"; + // The end date should be today to avoid showing null data for dates in the future + const submissionDate = "2024-03-08 to today"; const result = getDashboard( template, diff --git a/app/columns.tsx b/app/columns.tsx index 69fc1c62..744ce4a5 100644 --- a/app/columns.tsx +++ b/app/columns.tsx @@ -47,12 +47,12 @@ function OffsiteLink(href: string, linkText: any) { return ( {linkText} - + ); } diff --git a/lib/lookerUtils.ts b/lib/lookerUtils.ts index 769b7a92..5b1845cf 100644 --- a/lib/lookerUtils.ts +++ b/lib/lookerUtils.ts @@ -41,19 +41,13 @@ export function getLookerSubmissionTimestampDateFilter( ): string { if (isCompleted && startDate && endDate) { // This case covers completed experiments with defined startDate and - // endDate from the Experimenter API. - return `${startDate} to ${endDate}`; - } else if ( - !isCompleted && - startDate && - endDate && - new Date() < new Date(endDate) - ) { - // This case covers experiments that haven't reached their proposed end date. + // endDate from the Experimenter API, with the endDate being today or earlier. return `${startDate} to ${endDate}`; } else if (startDate) { - // This case covers experiments that are still ongoing past their proposed - // end date. + // This case covers experiments that haven't reached their proposed end date. + // This case also covers experiments that are still ongoing past their proposed + // to prevent issues with the Looker dashboards showing no data for to dates in + // the future. return `${startDate} to today`; } else { // This case covers any messages with undefined startDate and endDate.