Skip to content
Snippets Groups Projects
Commit f82aeb05 authored by David Monjoie's avatar David Monjoie
Browse files

[FIX] event: fix registration confirmation delay

The previous line was O(n^2). With n=1200 like we just have now,
things didn't look good for this loop and confirming an attendee
registration to such event took approx. 13 seconds.

Since the list comprehension is in no mean linked to the value
of "item" in the filter, I simply moved it out so it is only
computed once.
parent 9ba56987
Branches
Tags
No related merge requests found
......@@ -71,7 +71,8 @@ class EventMailScheduler(models.Model):
if self.interval_type == 'after_sub':
# update registration lines
lines = []
for registration in filter(lambda item: item not in [mail_reg.registration_id for mail_reg in self.mail_registration_ids], self.event_id.registration_ids):
reg_ids = [mail_reg.registration_id for mail_reg in self.mail_registration_ids]
for registration in filter(lambda item: item not in reg_ids, self.event_id.registration_ids):
lines.append((0, 0, {'registration_id': registration.id}))
if lines:
self.write({'mail_registration_ids': lines})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment