Skip to content

Commit

Permalink
feat(frontend): Include only booked participants in iCal export
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed May 17, 2024
1 parent b157293 commit 960017b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/frontend/src/app/poll/ical/ical.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ export class IcalComponent implements OnInit {
});

for (const event of this.getExportedEvents()) {
const eventParticipants = participants.filter(p => p.selection[event._id] === 'yes' || p.selection[event._id] === 'maybe');
const eventParticipants = participants.filter(p => {
if (p.selection[event._id] !== 'yes' && p.selection[event._id] !== 'maybe') {
return false;
}
const bookedEvent = poll.bookedEvents[event._id];
if (config.onlyBookedEvents && Array.isArray(bookedEvent) && !bookedEvent.includes(p._id)) {
return false;
}
return true;
});

let summary = config.customTitle || poll.title;
if (eventParticipants.length === 1) {
Expand Down

0 comments on commit 960017b

Please sign in to comment.