Add total guest count to RSVP lists - Show total number of attendees including guests

This commit is contained in:
Starstrike
2025-05-01 16:28:53 -04:00
parent bc8ac57697
commit 45b05b508c
2 changed files with 14 additions and 2 deletions

View File

@@ -601,7 +601,13 @@ const EventAdmin: React.FC = () => {
</Box>
<Typography variant="h6" gutterBottom>
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)}
</Typography>
<TableContainer sx={{

View File

@@ -242,7 +242,13 @@ const EventView: React.FC = () => {
</Box>
<Typography variant="h6" gutterBottom>
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)}
</Typography>
<TableContainer sx={{