2 KiB
2 KiB
Task 09: Паритет eligibleParticipantsCount между драйверами
Assigned to: Antigravity (Implementation Orchestrator)
Priority: MEDIUM (UI data accuracy & driver parity)
Date: 2026-08-21
Base SHA: 4e095553a11636cca298e75c799c92b07eb31396
Scope
- Harmonize
eligibleParticipantsCountcalculation acrossPrismaGiveawayRepositoryandMemoryGiveawayRepository:- Single unified semantic:
- If
drawResultexists (after draw): usedrawResult.totalEligibleCount. - If before draw: calculate
eligibleParticipantsCountas the count of eligible participants (eligible === true).
- If
- Single unified semantic:
- Efficient Prisma query:
- In
PrismaGiveawayRepository.listGiveawaysSummary, do NOT load full participant records. - Use Prisma relational count with filter or aggregate:
In Prisma query:
To count eligible participants without full records: In Prisma schema,_count: { select: { participants: true, } }participantsis a relation onGiveaway. Can Prisma do_countwith filter inselect? In Prisma Client 5.x:
Prisma 5 does not support filtered_count: { select: { participants: true, } }_countinsideselecton nested relations, but we can do a grouped/filtered count or query efficiently. Let's check how Prisma handles_countor howlistGiveawaysSummaryis implemented.
- In
- Check all other fields of
GiveawaySummaryfor driver parity:id,platform,sourceUrl,platformOwnerId,platformPostId,title,postImageUrl,status,winnersCount,reserveWinnersCount,createdAt,updatedAt,drawnAt,totalParticipantsCount,eligibleParticipantsCount,hasDrawResult,algorithmVersion.
- Keep
GET /api/giveawayslightweight (zero participant arrays, zero seed leakage). - Create test suite
tests/summary-count-parity.test.ts. - Full gate verification & report in
agents/antigravity/done/TASK-2026-08-21-09-summary-count-parity.md.