From 514ad7ccdf51968980cd6d9d4cb12263ae2bc368 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 24 Aug 2022 18:55:25 -0300 Subject: [PATCH] fix: lastUpdatedAt and lastUpdatedAtTransaction --- src/utils/helpers/account.ts | 9 +++++++++ src/utils/helpers/nft.ts | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/utils/helpers/account.ts b/src/utils/helpers/account.ts index 715dbac..b21de96 100644 --- a/src/utils/helpers/account.ts +++ b/src/utils/helpers/account.ts @@ -42,6 +42,9 @@ export function getOrCreateUser( user.save(); proxy.userCount = proxy.userCount + BIGINT_ONE; + } else if (user != null) { + user.lastUpdatedAt = compoundIdToSortableDecimal(transactionId); + user.lastUpdatedAtTransaction = transactionId; } return user as User; @@ -68,6 +71,9 @@ export function getOrCreatePool( pool.save(); proxy.poolCount = proxy.poolCount + BIGINT_ONE; + } else if (pool != null) { + pool.lastUpdatedAt = compoundIdToSortableDecimal(transactionId); + pool.lastUpdatedAtTransaction = transactionId; } return pool as Pool; @@ -181,6 +187,9 @@ export function getProtocolAccount(transactionId: String): ProtocolAccount { account.lastUpdatedAtTransaction = transactionId; account.save(); + } else { + account.lastUpdatedAt = compoundIdToSortableDecimal(transactionId); + account.lastUpdatedAtTransaction = transactionId; } return account as ProtocolAccount; diff --git a/src/utils/helpers/nft.ts b/src/utils/helpers/nft.ts index 3113e6e..4606e8b 100644 --- a/src/utils/helpers/nft.ts +++ b/src/utils/helpers/nft.ts @@ -43,6 +43,9 @@ export function getOrCreateAccountNFTSlot( slot.lastUpdatedAt = compoundIdToSortableDecimal(transactionId); slot.createdAtTransaction = transactionId; slot.lastUpdatedAtTransaction = transactionId; + } else if (slot != null) { + slot.lastUpdatedAt = compoundIdToSortableDecimal(transactionId); + slot.lastUpdatedAtTransaction = transactionId; } return slot as AccountNFTSlot;