diff --git a/scripts/db-streak-recompute.ts b/scripts/db-streak-recompute.ts index 262f0427..e202baa5 100644 --- a/scripts/db-streak-recompute.ts +++ b/scripts/db-streak-recompute.ts @@ -35,14 +35,16 @@ for await (const { pubkey } of statsQuery.stream(10)) { start = createdAt; } - await kysely - .updateTable('author_stats') - .set({ - streak_end: end, - streak_start: start, - }) - .where('pubkey', '=', pubkey) - .execute(); + if (start && end) { + await kysely + .updateTable('author_stats') + .set({ + streak_end: end, + streak_start: start, + }) + .where('pubkey', '=', pubkey) + .execute(); + } } Deno.exit();