Add total guest count to RSVP lists - Show total number of attendees including guests
This commit is contained in:
@@ -601,7 +601,13 @@ const EventAdmin: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Typography variant="h6" gutterBottom>
|
<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>
|
</Typography>
|
||||||
|
|
||||||
<TableContainer sx={{
|
<TableContainer sx={{
|
||||||
|
|||||||
@@ -242,7 +242,13 @@ const EventView: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Typography variant="h6" gutterBottom>
|
<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>
|
</Typography>
|
||||||
|
|
||||||
<TableContainer sx={{
|
<TableContainer sx={{
|
||||||
|
|||||||
Reference in New Issue
Block a user