Format InsightsPage

This commit is contained in:
Brandon Presley 2023-11-08 15:37:34 +13:00
parent 31b11aefd6
commit d41bafdecb
1 changed files with 10 additions and 10 deletions

View File

@ -37,19 +37,19 @@ export default function InsightsPage() {
if (period === Periods.SixMonths) difference = "-6 months"; if (period === Periods.SixMonths) difference = "-6 months";
const selectWeeks = ` const selectWeeks = `
SELECT strftime('%w', created) as week, COUNT(*) as count SELECT strftime('%w', created) as week, COUNT(*) as count
FROM sets FROM sets
WHERE DATE(created) >= DATE('now', 'weekday 0', '${difference}') WHERE DATE(created) >= DATE('now', 'weekday 0', '${difference}')
GROUP BY week GROUP BY week
HAVING week IS NOT NULL HAVING week IS NOT NULL
ORDER BY count DESC; ORDER BY count DESC;
`; `;
const selectHours = ` const selectHours = `
SELECT strftime('%H', created) AS hour, COUNT(*) AS count SELECT strftime('%H', created) AS hour, COUNT(*) AS count
FROM sets FROM sets
WHERE DATE(created) >= DATE('now', 'weekday 0', '${difference}') WHERE DATE(created) >= DATE('now', 'weekday 0', '${difference}')
GROUP BY hour GROUP BY hour
having hour is not null having hour is not null
ORDER BY hour ORDER BY hour
`; `;
setTimeout( setTimeout(