Skip to content

Commit

Permalink
fix: non-null filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
hieronx committed Jun 11, 2024
1 parent 9983b93 commit 0d9d433
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mappings/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d9d433

Please sign in to comment.