Skip to content

Commit

Permalink
Add date to qf round donation existance condition (#1870)
Browse files Browse the repository at this point in the history
* add date to qf round donation existance condition

* fix test donation to fit into the qfround timeframe
  • Loading branch information
CarlosQ96 authored Nov 8, 2024
1 parent d2b614d commit be46140
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/repositories/donationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/donationResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
Expand Down

0 comments on commit be46140

Please sign in to comment.