Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Refactor query parameter handling in analytics API and utility functions

Bill Yang4555b04e9be0
diff --git a/client/src/api/utils.ts b/client/src/api/utils.ts
index 3e09eca47..5cc7a5ede 100644
--- a/client/src/api/utils.ts
+++ b/client/src/api/utils.ts
@@ -43,9 +43,7 @@ export function getQueryParams(
pastMinutesEnd?: number;
} = {}
): Record<string, any> {
- const isPast24HoursMode = time.mode === "last-24-hours";
-
- return isPast24HoursMode
+ return options.pastMinutesStart || options.pastMinutesEnd
? {
// Past minutes approach for last-24-hours mode
timeZone,
diff --git a/server/src/api/analytics/getOverviewBucketed.ts b/server/src/api/analytics/getOverviewBucketed.ts
index c0d1055b1..953082a20 100644
--- a/server/src/api/analytics/getOverviewBucketed.ts
+++ b/server/src/api/analytics/getOverviewBucketed.ts
@@ -232,12 +232,6 @@ export async function getOverviewBucketed(
return res.status(403).send({ error: "Forbidden" });
}
- // Handle specific past minutes range if provided
- const pastMinutesRange =
- pastMinutesStart && pastMinutesEnd
- ? { start: Number(pastMinutesStart), end: Number(pastMinutesEnd) }
- : undefined;
-
const query = getQuery({
startDate,
endDate,