From f2791ef631dc63d6c54d487827f46a25bb40ae8c Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 7 Nov 2024 15:48:13 +0100 Subject: [PATCH 1/2] add date to qf round donation existance condition --- src/repositories/donationRepository.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/repositories/donationRepository.ts b/src/repositories/donationRepository.ts index 4b649faaf..5ec0e093d 100644 --- a/src/repositories/donationRepository.ts +++ b/src/repositories/donationRepository.ts @@ -661,12 +661,14 @@ export async function isVerifiedDonationExistsInQfRound(params: { ` SELECT EXISTS ( SELECT 1 - FROM donation + FROM donation as d + INNER JOIN "qf_round" as qr on qr.id = $1 WHERE - status = 'verified' AND - "qfRoundId" = $1 AND - "projectId" = $2 AND - "userId" = $3 + d.status = 'verified' AND + d."qfRoundId" = $1 AND + d."projectId" = $2 AND + d."userId" = $3 AND + d."createdAt" >= qr."beginDate" AND d."createdAt" <= qr."endDate" ) AS exists; `, [params.qfRoundId, params.projectId, params.userId], From a6e527d1bbf20b41c97f532768710b92d08bc788 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 7 Nov 2024 16:28:55 +0100 Subject: [PATCH 2/2] fix test donation to fit into the qfround timeframe --- src/resolvers/donationResolver.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolvers/donationResolver.test.ts b/src/resolvers/donationResolver.test.ts index 11b80dace..dfb19d3f1 100644 --- a/src/resolvers/donationResolver.test.ts +++ b/src/resolvers/donationResolver.test.ts @@ -715,7 +715,7 @@ function doesDonatedToProjectInQfRoundTestCases() { await saveDonationDirectlyToDb( createDonationData({ status: DONATION_STATUS.VERIFIED, - createdAt: moment().add(50, 'days').toDate(), + createdAt: moment().add(8, 'days').toDate(), valueUsd: 20, qfRoundId: qfRound.id, }),