Skip to content

Commit be919b0

Browse files
authored
Update Looker dashboard submission timestamp logic (#657)
* Update looker submission timestamp function * Fix small css alignment * Address PR comments
1 parent 2bea3ff commit be919b0

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Friday, April 11th, 2025
2+
3+
### Fixed
4+
5+
- Fixed submission timestamp filter calculations for Looker dashboards so that any dates in the future won't be showing null data
6+
17
## Thursday, April 10th, 2025
28

39
### Added

__tests__/lib/lookerUtils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("getLookerSubmissionTimestampDateFilter", () => {
6363

6464
const result = getLookerSubmissionTimestampDateFilter(startDate, endDate);
6565

66-
expect(result).toEqual("2024-05-08 to 3024-06-10");
66+
expect(result).toEqual("2024-05-08 to today");
6767
});
6868

6969
it("returns a date filter from the startDate to endDate when startDate and endDate are defined and the message is completed", () => {

__tests__/lib/messageUtils.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ describe("getDashboard", () => {
142142
const template = "feature_callout";
143143
const msgId = "a:bc"; // weird chars to test URI encoding
144144
const startDate = "2024-03-08";
145-
const endDate = "2025-06-28";
145+
const endDate = "3025-06-28";
146146
const dashboardId = getDashboardIdForTemplate(template);
147-
const submissionDate = "2024-03-08 to 2025-06-28";
147+
// The end date should be today to avoid showing null data for dates in the future
148+
const submissionDate = "2024-03-08 to today";
148149

149150
const result = getDashboard(
150151
template,

app/columns.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ function OffsiteLink(href: string, linkText: any) {
4747
return (
4848
<a
4949
href={href}
50-
className="text-xs/[180%] whitespace-nowrap flex flex-row items-center gap-x-1"
50+
className="text-xs/[180%] whitespace-nowrap"
5151
target="_blank"
5252
rel="noreferrer"
5353
>
5454
{linkText}
55-
<SquareArrowOutUpRight size={10} />
55+
<SquareArrowOutUpRight size={10} className="inline ml-1" />
5656
</a>
5757
);
5858
}

lib/lookerUtils.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,13 @@ export function getLookerSubmissionTimestampDateFilter(
4141
): string {
4242
if (isCompleted && startDate && endDate) {
4343
// This case covers completed experiments with defined startDate and
44-
// endDate from the Experimenter API.
45-
return `${startDate} to ${endDate}`;
46-
} else if (
47-
!isCompleted &&
48-
startDate &&
49-
endDate &&
50-
new Date() < new Date(endDate)
51-
) {
52-
// This case covers experiments that haven't reached their proposed end date.
44+
// endDate from the Experimenter API, with the endDate being today or earlier.
5345
return `${startDate} to ${endDate}`;
5446
} else if (startDate) {
55-
// This case covers experiments that are still ongoing past their proposed
56-
// end date.
47+
// This case covers experiments that haven't reached their proposed end date.
48+
// This case also covers experiments that are still ongoing past their proposed
49+
// to prevent issues with the Looker dashboards showing no data for to dates in
50+
// the future.
5751
return `${startDate} to today`;
5852
} else {
5953
// This case covers any messages with undefined startDate and endDate.

0 commit comments

Comments
 (0)