def cycle_waitlist(): # get the current waitlist waitlist = list(Hacker.objects.filter(waitlist=True).order_by('waitlist_date')) # while the event is not full and there are waitlisted hackers while not Settings.is_full() and len(waitlist) > 0: hacker = waitlist.pop(0) # Hacker can be waitlisted but not in waitlist(e.g late) if hacker.profile.state == 'waitlist': hacker.unwaitlist()
def admit(self, send_email=True): # Admit hacker and send notification email # Also called when a hacker that has withdrowned changes their mind self.admitted = True self.declined = False self.waitlist = False self.withdraw = False self.save() if Settings.is_full(): # If event is full return self.put_on_waitlist(send_email) if send_email: tasks.send_notify_admitted.delay(self.id)