From 45b05b508cb6d84e022a48ff4bdf078bb2b9e14b Mon Sep 17 00:00:00 2001 From: Starstrike Date: Thu, 1 May 2025 16:28:53 -0400 Subject: [PATCH] Add total guest count to RSVP lists - Show total number of attendees including guests --- frontend/src/components/EventAdmin.tsx | 8 +++++++- frontend/src/components/EventView.tsx | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/EventAdmin.tsx b/frontend/src/components/EventAdmin.tsx index 5f4b2ac..3c05bdd 100644 --- a/frontend/src/components/EventAdmin.tsx +++ b/frontend/src/components/EventAdmin.tsx @@ -601,7 +601,13 @@ const EventAdmin: React.FC = () => { - RSVPs ({rsvps.length}) + RSVPs ({rsvps.length}) | Total Guests: {rsvps.reduce((total, rsvp) => { + // Count the RSVP person as 1 if they're attending + const rsvpCount = rsvp.attending === 'yes' ? 1 : 0; + // Add their guests if they're bringing any + const guestCount = (rsvp.attending === 'yes' && rsvp.bringing_guests === 'yes') ? rsvp.guest_count : 0; + return total + rsvpCount + guestCount; + }, 0)} { - RSVPs ({rsvps.length}) + RSVPs ({rsvps.length}) | Total Guests: {rsvps.reduce((total, rsvp) => { + // Count the RSVP person as 1 if they're attending + const rsvpCount = rsvp.attending === 'yes' ? 1 : 0; + // Add their guests if they're bringing any + const guestCount = (rsvp.attending === 'yes' && rsvp.bringing_guests === 'yes') ? rsvp.guest_count : 0; + return total + rsvpCount + guestCount; + }, 0)}