bug fix: location expense counted unpaid bills
This commit is contained in:
@@ -15,7 +15,7 @@ export interface LocationCardProps {
|
|||||||
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearMonth, bills }}) => {
|
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearMonth, bills }}) => {
|
||||||
|
|
||||||
// sum all the billAmounts
|
// sum all the billAmounts
|
||||||
const monthlyExpense = bills.reduce((acc, bill) => acc + (bill.payedAmount ?? 0), 0);
|
const monthlyExpense = bills.reduce((acc, bill) => bill.paid ? acc + (bill.payedAmount ?? 0) : acc, 0);
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div data-key={_id } className="card card-compact card-bordered max-w-[30em] bg-base-100 shadow-s my-1">
|
<div data-key={_id } className="card card-compact card-bordered max-w-[30em] bg-base-100 shadow-s my-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user