From 0d9d43399136c48f1cb80b70f440c9617a0542e8 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Tue, 11 Jun 2024 11:43:42 +0200 Subject: [PATCH] fix: non-null filtering --- src/mappings/services/assetService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mappings/services/assetService.ts b/src/mappings/services/assetService.ts index e301b966..2cffcb23 100644 --- a/src/mappings/services/assetService.ts +++ b/src/mappings/services/assetService.ts @@ -140,7 +140,9 @@ export class AssetService extends Asset { const oldOutstaidingInterest = this.outstandingInterest const oldTotalRepaidInterest = this.totalRepaidInterest - Object.assign(this, activeAssetData) + // Set all asset values that are non-null + const filteredAssetData = Object.fromEntries(Object.entries(activeAssetData).filter(([_, v]) => v != null)) + Object.assign(this, filteredAssetData) const deltaRepaidInterestAmount = this.totalRepaid - oldTotalRepaidInterest this.interestAccruedByPeriod = this.outstandingInterest - oldOutstaidingInterest + deltaRepaidInterestAmount