Skip to content

Commit

Permalink
Small change
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Apr 23, 2024
1 parent 1290292 commit deedf1a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/transaction_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {where} from "firebase/firestore";

export async function getCurrentBalance(user: User): Promise<number> {
const transactions = await getTransactions(user);
let balance = 0;
transactions.forEach(transaction => {balance += transaction.amount;});
const balance = transactions.reduce((sum, transaction) => sum + transaction.amount, 0);
return Math.round(balance * 100) / 100;
}

Expand Down

0 comments on commit deedf1a

Please sign in to comment.