more fixes, AI

This commit is contained in:
2026-03-31 22:10:30 +02:00
parent de1fa76e40
commit 2beb7aa75a
14 changed files with 121 additions and 67 deletions

View File

@@ -159,13 +159,18 @@ class EventParticipation(models.Model):
return self.user.username
def save(self, *args, **kwargs):
prev = EventParticipation.objects.filter(event=self.event, user=self.user)
if len(prev) == 0:
# For new objects, just save directly
if self.pk is None:
super().save(*args, **kwargs)
else:
prev = prev[0]
return
# For existing objects, only save if values changed
try:
prev = EventParticipation.objects.get(pk=self.pk)
if prev.status != self.status or prev.comment != self.comment:
super().save(*args, **kwargs)
except EventParticipation.DoesNotExist:
super().save(*args, **kwargs)
@staticmethod
def hasUserSetParticipationForAllEvents(user):