Skip to content

Commit

Permalink
fix wrong id
Browse files Browse the repository at this point in the history
  • Loading branch information
jeriox committed Mar 16, 2024
1 parent 5578cda commit e246bd6
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions ephios/core/services/notifications/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,30 +534,27 @@ def send(cls, event: Event, content: str):
responsible_users = get_users_with_perms(
event, with_superusers=False, only_with_perms_in=["change_event"]
)
for shift in event.shifts.all():
for participation in shift.participations.filter(
state__in={AbstractParticipation.States.CONFIRMED}
):
participant = participation.participant
if participant not in participants:
participants.add(participant)
user = (
participant.user if isinstance(participant, LocalUserParticipant) else None
)
if user in responsible_users:
continue
notifications.append(
Notification(
slug=cls.slug,
user=user,
data={
"email": participant.email,
"participation_id": event.id,
"event_id": event.id,
"content": content,
},
)
for participation in AbstractParticipation.objects.filter(
shift__event=event, state=AbstractParticipation.States.CONFIRMED
):
participant = participation.participant
if participant not in participants:
participants.add(participant)
user = participant.user if isinstance(participant, LocalUserParticipant) else None
if user in responsible_users:
continue
notifications.append(
Notification(
slug=cls.slug,
user=user,
data={
"email": participant.email,
"participation_id": participation.id,
"event_id": event.id,
"content": content,
},
)
)
for responsible in responsible_users:
notifications.append(
Notification(
Expand Down

0 comments on commit e246bd6

Please sign in to comment.