@@ -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