prep events partition

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-07-19 22:08:22 +02:00
parent ddc2ce338f
commit 3993b493e3
27 changed files with 136 additions and 71 deletions

View File

@@ -1,6 +1,6 @@
import { ALink } from '@/components/ui/button';
import { chQuery } from '@openpanel/db';
import { chQuery, TABLE_NAMES } from '@openpanel/db';
import AnimatedText from './animated-text';
import { Heading1, Lead2 } from './copy';
@@ -15,7 +15,7 @@ function shortNumber(num: number) {
export async function Hero() {
const projects = await chQuery<{ project_id: string; count: number }>(
'SELECT project_id, count(*) as count from events GROUP by project_id order by count()'
`SELECT project_id, count(*) as count from ${TABLE_NAMES.events} GROUP by project_id order by count()`
);
const projectCount = projects.length;
const eventCount = projects.reduce((acc, { count }) => acc + count, 0);