From 99dfe5a302106d46cfb6b501708c5f5de7afeb9d Mon Sep 17 00:00:00 2001 From: Norbert Maciaszek Date: Sat, 15 Nov 2025 16:48:22 +0100 Subject: [PATCH] Update YearOverview component to include 'ready' gift status in calculations and statistics display, adjusting total cost calculations and modifying the presentation of gift counts accordingly. --- src/components/organisms/YearOverview/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/YearOverview/index.tsx b/src/components/organisms/YearOverview/index.tsx index 7484ada..1a9859f 100644 --- a/src/components/organisms/YearOverview/index.tsx +++ b/src/components/organisms/YearOverview/index.tsx @@ -26,12 +26,16 @@ export const YearOverview: FC = async ({ year, heading }) => { const planned = gifts.filter((gift) => gift.status === 'planned'); const decided = gifts.filter((gift) => gift.status === 'decided'); const bought = gifts.filter((gift) => gift.status === 'bought'); + const ready = gifts.filter((gift) => gift.status === 'ready'); const wrapped = gifts.filter((gift) => gift.status === 'wrapped'); const totalCost = gifts.reduce((acc, gift) => acc + gift.cost, 0); const totalCostPlanned = planned.reduce((acc, gift) => acc + gift.cost, 0) + decided.reduce((acc, gift) => acc + gift.cost, 0); - const totalCostBought = bought.reduce((acc, gift) => acc + gift.cost, 0); + const totalCostBought = + bought.reduce((acc, gift) => acc + gift.cost, 0) + + ready.reduce((acc, gift) => acc + gift.cost, 0) + + wrapped.reduce((acc, gift) => acc + gift.cost, 0); const remainingBudget = data.budgetLimit - totalCostBought; @@ -42,7 +46,7 @@ export const YearOverview: FC = async ({ year, heading }) => { - +