Skip to content

Commit 2e336b2

Browse files
committed
common: fix return in filter and to_timestamp query
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent 19602c6 commit 2e336b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/indexer-common/src/allocations/__tests__/tap.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ describe('TAP', () => {
313313
redeemedAt: null,
314314
}
315315
await queryFeeModels.receiptAggregateVouchers.create(rav2)
316-
let ravs = await tapCollector['pendingRAVs']()
316+
const ravs = await tapCollector['pendingRAVs']()
317317
await tapCollector['markRavsInTransactionsAsRedeemed'](transactions, ravs)
318318
const redeemedRavs = await queryFeeModels.receiptAggregateVouchers.findAll({
319319
where: {
@@ -326,7 +326,7 @@ describe('TAP', () => {
326326
})
327327
// Expect redeemed rav to be returned here
328328
expect(redeemedRavs).toEqual([
329-
expect.objectContaining({ ...rav2, redeemedAt: nowSecs }),
329+
expect.objectContaining({ ...rav2, redeemedAt: new Date(nowSecs * 1000) }),
330330
])
331331
})
332332

packages/indexer-common/src/allocations/tap-collector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export class TapCollector {
384384
// transactions for different senders with the same allocation id
385385
.filter((tx) => {
386386
// check if exists in the ravsLastNotFinal list
387-
!!ravsLastNotFinal.find(
387+
return !!ravsLastNotFinal.find(
388388
(rav) =>
389389
// rav has the same sender address as tx
390390
toAddress(rav.senderAddress) === toAddress(tx.sender.id) &&
@@ -695,7 +695,7 @@ export class TapCollector {
695695
// https://github.com/sequelize/sequelize/issues/7664 (bug been open for 7 years no fix yet or ever)
696696
const query = `
697697
UPDATE scalar_tap_ravs
698-
SET redeemed_at = ${timestamp ? timestamp : 'NOW()'}
698+
SET redeemed_at = ${timestamp ? `to_timestamp(${timestamp})` : 'NOW()'}
699699
WHERE allocation_id = '${allocationId
700700
.toString()
701701
.toLowerCase()

0 commit comments

Comments
 (0)