From 85e142ca7ba604768e671a29bdbffa60d581ce99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Wed, 17 Jan 2024 16:37:07 +0100 Subject: [PATCH] bug fix: location expense counted unpaid bills --- app/ui/LocationCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/LocationCard.tsx b/app/ui/LocationCard.tsx index 68a207c..7e9c613 100644 --- a/app/ui/LocationCard.tsx +++ b/app/ui/LocationCard.tsx @@ -15,7 +15,7 @@ export interface LocationCardProps { export const LocationCard:FC = ({location: { _id, name, yearMonth, bills }}) => { // 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(