Skip to content

Commit

Permalink
common: fix return in filter and to_timestamp query
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Dec 18, 2024
1 parent 9d34c19 commit 00c1a40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/indexer-common/src/allocations/__tests__/tap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ describe('TAP', () => {
redeemedAt: null,
}
await queryFeeModels.receiptAggregateVouchers.create(rav2)
let ravs = await tapCollector['pendingRAVs']()
const ravs = await tapCollector['pendingRAVs']()
await tapCollector['markRavsInTransactionsAsRedeemed'](transactions, ravs)
const redeemedRavs = await queryFeeModels.receiptAggregateVouchers.findAll({
where: {
Expand All @@ -326,7 +326,7 @@ describe('TAP', () => {
})
// Expect redeemed rav to be returned here
expect(redeemedRavs).toEqual([
expect.objectContaining({ ...rav2, redeemedAt: nowSecs }),
expect.objectContaining({ ...rav2, redeemedAt: new Date(nowSecs * 1000) }),
])
})

Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-common/src/allocations/tap-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export class TapCollector {
// transactions for different senders with the same allocation id
.filter((tx) => {
// check if exists in the ravsLastNotFinal list
!!ravsLastNotFinal.find(
return !!ravsLastNotFinal.find(
(rav) =>
// rav has the same sender address as tx
toAddress(rav.senderAddress) === toAddress(tx.sender.id) &&
Expand Down Expand Up @@ -695,7 +695,7 @@ export class TapCollector {
// https://github.com/sequelize/sequelize/issues/7664 (bug been open for 7 years no fix yet or ever)
const query = `
UPDATE scalar_tap_ravs
SET redeemed_at = ${timestamp ? timestamp : 'NOW()'}
SET redeemed_at = ${timestamp ? `to_timestamp(${timestamp})` : 'NOW()'}
WHERE allocation_id = '${allocationId
.toString()
.toLowerCase()
Expand Down

0 comments on commit 00c1a40

Please sign in to comment.