Skip to content

Commit dba366b

Browse files
authored
Merge pull request #1665 from Northeastern-Electric-Racing/#1584-fix-finance-total-owed
#1584 changed 'total owed' to 'currently owed' and fixed owed amount …
2 parents 2943caf + e875005 commit dba366b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/frontend/src/pages/FinancePage/RefundsSection.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ const Refunds = ({ userReimbursementRequests, allReimbursementRequests }: Refund
7676
(accumulator: number, currentVal: Reimbursement) => accumulator + currentVal.amount,
7777
0
7878
);
79-
const totalOwed = displayedReimbursementRequests.reduce(
80-
(accumulator: number, currentVal: ReimbursementRequest) => accumulator + currentVal.totalCost,
81-
0
82-
);
83-
const percentRefunded = (totalReceived / totalOwed) * 100;
79+
const currentlyOwed =
80+
displayedReimbursementRequests.reduce(
81+
(accumulator: number, currentVal: ReimbursementRequest) => accumulator + currentVal.totalCost,
82+
0
83+
) - totalReceived;
84+
const percentRefunded = (totalReceived / currentlyOwed) * 100;
8485

8586
const tabs = [{ label: 'My Refunds', value: 0 }];
8687
if (user.isFinance) tabs.push({ label: 'All Club Refunds', value: 1 });
@@ -98,7 +99,7 @@ const Refunds = ({ userReimbursementRequests, allReimbursementRequests }: Refund
9899
>
99100
<Box sx={{ display: 'flex', flexDirection: 'horizontal', justifyContent: 'space-between', paddingX: '30px' }}>
100101
<RefundHeader header="Total Received" data={`$${centsToDollar(totalReceived)}`} />
101-
<RefundHeader header="Total Owed" data={`$${centsToDollar(totalOwed)}`} />
102+
<RefundHeader header="Currently Owed" data={`$${centsToDollar(currentlyOwed)}`} />
102103
</Box>
103104
<NERProgressBar sx={{ margin: '20px' }} variant="determinate" value={percentRefunded} />
104105
<TableContainer component={Paper}>

0 commit comments

Comments
 (0)