Skip to content

Commit 94bfb77

Browse files
committed
Fix: all due
1 parent 794f252 commit 94bfb77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/src/utils/pastDueCalc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const getAllDue = async (backend, id) => {
3636
let previousTotal = previousTotals.reduce((acc, total) => acc + total, 0);
3737

3838
const currentTotal = await backend.get(`/invoices/total/${id}`);
39-
previousTotal = currentTotal.data.total;
39+
previousTotal += currentTotal.data.total;
4040

4141
const paidTotals = await Promise.all(
4242
previousInvoices.map(async (invoice) => {
@@ -47,7 +47,7 @@ export const getAllDue = async (backend, id) => {
4747
let paidTotal = paidTotals.reduce((acc, paid) => acc + paid, 0);
4848

4949
const currentPaid = await backend.get(`/invoices/paid/${id}`);
50-
paidTotal = currentPaid.data.total;
50+
paidTotal += currentPaid.data.total;
5151

5252
const pastDue = (previousTotal - paidTotal) > 0 ? (previousTotal - paidTotal) : 0;
5353
return pastDue;

0 commit comments

Comments
 (0)