Update rounds.service.ts

This commit is contained in:
Artem Gorlenko 2026-10-22 14:37:07 +05:00
parent cd69aec83e
commit d1097a5089

View File

@ -252,7 +252,8 @@ export class RoundsService {
@Cron(CronExpression.EVERY_MINUTE)
async closeExpired() {
if (config.disableCron) return;
const closed: { id: string; site_id: string; status: RoundStatus; organization_id: string; done: number; total: number }[] =
// Для UPDATE драйвер TypeORM (postgres) возвращает не строки, а пару [строки RETURNING, число изменённых].
const [closed]: [{ id: string; site_id: string; status: RoundStatus; organization_id: string; done: number; total: number }[], number] =
await this.db.query(
`UPDATE rounds r SET status = CASE
WHEN r.checkpoints_done = 0 THEN 'missed'