diff --git a/InsightsPage.tsx b/InsightsPage.tsx index 94bf668..ee7b496 100644 --- a/InsightsPage.tsx +++ b/InsightsPage.tsx @@ -35,6 +35,7 @@ export default function InsightsPage() { if (period === Periods.TwoMonths) difference = "-2 months"; if (period === Periods.ThreeMonths) difference = "-3 months"; if (period === Periods.SixMonths) difference = "-6 months"; + const selectWeeks = ` SELECT strftime('%w', created) as week, COUNT(*) as count FROM sets diff --git a/ViewGraph.tsx b/ViewGraph.tsx index dcea542..a64fa45 100644 --- a/ViewGraph.tsx +++ b/ViewGraph.tsx @@ -28,8 +28,10 @@ export default function ViewGraph() { let difference = "-7 days"; if (period === Periods.Monthly) difference = "-1 months"; else if (period === Periods.Yearly) difference = "-1 years"; + let group = "%Y-%m-%d"; if (period === Periods.Yearly) group = "%Y-%m"; + const builder = setRepo .createQueryBuilder() .select("STRFTIME('%Y-%m-%d', created)", "created") @@ -41,6 +43,7 @@ export default function ViewGraph() { }) .groupBy("name") .addGroupBy(`STRFTIME('${group}', created)`); + switch (metric) { case Metrics.Best: builder