Skip to content

Commit

Permalink
filter
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Sep 23, 2024
1 parent e06fa75 commit f6ebe3f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/tigerbeetle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,14 @@ export class TigerBeetleStores implements Stores {
limit: 100000,
flags: 0,
});
console.log(i, ledgerBalances.map(({ id, debits_posted, credits_posted }) => {
return `${id - BigInt(i)*BigInt(1000000)}:${(BigInt(debits_posted) - BigInt(credits_posted))/(BigInt(1000000)*BigInt(1000000))}`;
}));
const balances = {};
ledgerBalances
.filter(id => (Number(id - BigInt(i)*BigInt(1000000)) !== 0)) // filter out bank
.filter(id => (Number(id - BigInt(i)*BigInt(1000000)) !== i)) // filter out self
.map(({ id, debits_posted, credits_posted }) => {
balances[Number(id - BigInt(i)*BigInt(1000000))] = Number((BigInt(debits_posted) - BigInt(credits_posted))/(BigInt(1000000)*BigInt(1000000)));
})
console.log(i, balances);
}
}
async logLedgers(): Promise<void> {
Expand Down

0 comments on commit f6ebe3f

Please sign in to comment.