Skip to content

Commit

Permalink
Fix tax report if bfx-api pub-trades endpoint does not return array
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIMkaRU committed Jul 24, 2024
1 parent ee25929 commit d796142
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions workers/loc.api/sync/transaction.tax.report/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,19 @@ class TransactionTaxReport {
interrupter
})

const pubTrades = Array.isArray(res)
? res
: []

if (isTestEnv) {
/*
* Need to reverse pub-trades array for test env
* as mocked test server return data in desc order
*/
return res.reverse()
return pubTrades.reverse()
}

return res
return pubTrades
}

async #updateExactUsdValueInColls (trxs) {
Expand Down

0 comments on commit d796142

Please sign in to comment.