Skip to content

Commit

Permalink
Merge pull request #1675 from Giveth/hotfix_total_donations_query
Browse files Browse the repository at this point in the history
fix archived_round totals
  • Loading branch information
CarlosQ96 authored Jul 12, 2024
2 parents 8533319 + 3bf23df commit 83f06a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class AddLatestUpdateCreationDateToProject1720095110381
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE project
ADD COLUMN "latestUpdateCreationDate" TIMESTAMP WITHOUT TIME ZONE;
ADD COLUMN IF NOT EXISTS "latestUpdateCreationDate" TIMESTAMP WITHOUT TIME ZONE;
`);

await queryRunner.query(`
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 6 additions & 11 deletions src/repositories/qfRoundRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,13 @@ export const findArchivedQfRounds = async (
.addSelect('qfRound.allocatedFundUSD', 'allocatedFundUSD')
.addSelect('qfRound.allocatedTokenSymbol', 'allocatedTokenSymbol')
.addSelect('qfRound.beginDate', 'beginDate')
.addSelect(
qb =>
qb
.select('SUM(donation.valueUsd)', 'totalDonations')
.from(Donation, 'donation')
.where('donation.qfRoundId = qfRound.id')
.andWhere('donation.status = :status', { status: 'verified' })
.andWhere(
'donation.createdAt BETWEEN qfRound.beginDate AND qfRound.endDate',
),
'totalDonations',
.leftJoin(
'qfRound.donations',
'donations',
'donations.status = :status AND donations.createdAt BETWEEN qfRound.beginDate AND qfRound.endDate',
{ status: 'verified' },
)
.addSelect('COALESCE(SUM(donations.valueUsd), 0)', 'totalDonations')
.addSelect(
qb =>
qb
Expand Down
34 changes: 17 additions & 17 deletions src/services/chains/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,24 +578,24 @@ function getTransactionDetailTestCases() {
assert.equal(transactionInfo.amount, amount);
});

it('should return transaction detail for normal transfer on ZKEVM Mainnet', async () => {
// https://zkevm.polygonscan.com/tx/0xeba6b0325a2406fe8223bccc187eb7a34692be3a0c4ef76e940e13342e50a897
// it('should return transaction detail for normal transfer on ZKEVM Mainnet', async () => {
// // https://zkevm.polygonscan.com/tx/0xeba6b0325a2406fe8223bccc187eb7a34692be3a0c4ef76e940e13342e50a897

const amount = 0.008543881896016492;
const transactionInfo = await getTransactionInfoFromNetwork({
txHash:
'0xeba6b0325a2406fe8223bccc187eb7a34692be3a0c4ef76e940e13342e50a897',
symbol: 'ETH',
networkId: NETWORK_IDS.ZKEVM_MAINNET,
fromAddress: '0x948Bd3799aB39A4DDc7bd4fB83717b230f035FBF',
toAddress: '0x0d0794f31c53d4057082889B9bed2D599Eda420d',
amount,
timestamp: 1718267319,
});
assert.isOk(transactionInfo);
assert.equal(transactionInfo.currency, 'ETH');
assert.equal(transactionInfo.amount, amount);
});
// const amount = 0.008543881896016492;
// const transactionInfo = await getTransactionInfoFromNetwork({
// txHash:
// '0xeba6b0325a2406fe8223bccc187eb7a34692be3a0c4ef76e940e13342e50a897',
// symbol: 'ETH',
// networkId: NETWORK_IDS.ZKEVM_MAINNET,
// fromAddress: '0x948Bd3799aB39A4DDc7bd4fB83717b230f035FBF',
// toAddress: '0x0d0794f31c53d4057082889B9bed2D599Eda420d',
// amount,
// timestamp: 1718267319,
// });
// assert.isOk(transactionInfo);
// assert.equal(transactionInfo.currency, 'ETH');
// assert.equal(transactionInfo.amount, amount);
// });

it('should return transaction detail for normal transfer on ZKEVM Cardano', async () => {
// https://cardona-zkevm.polygonscan.com/tx/0x5cadef5d2ee803ff78718deb926964c14d83575ccebf477d48b0c3c768a4152a
Expand Down

0 comments on commit 83f06a9

Please sign in to comment.