Skip to content
Snippets Groups Projects
Commit 01f286ad authored by Roang's avatar Roang
Browse files

Fix leftover channel targets in voucher model

parent 15a87853
Branches
Tags
No related merge requests found
......@@ -124,7 +124,7 @@ class Voucher(models.Model):
def do_auto_assignments(cls, conference: Conference = None, assemblies: list[Assembly] | None = None) -> int:
qs = cls.objects.filter(conference=conference) if conference is not None else cls.objects.all()
qs = qs.filter(enabled=True)
qs = qs.filter(target__in=Voucher.ASSEMBLY_TARGETS)
qs = qs.filter(target=Voucher.Target.ASSEMBLY)
total = 0
for voucher in qs.iterator():
......@@ -137,7 +137,7 @@ class Voucher(models.Model):
return total
def do_auto_assignment(self, assemblies: list[Assembly]) -> int:
if self.target not in self.ASSEMBLY_TARGETS:
if self.target != self.Target.ASSEMBLY:
raise NotImplementedError('Auto-Assignment of non assemblies not implemented yet.')
# nothing to do if we're not enabled or set to manual assignment
......@@ -199,7 +199,7 @@ class VoucherEntry(models.Model):
@cached_property
def target(self):
if self.voucher.target in Voucher.ASSEMBLY_TARGETS:
if self.voucher.target == Voucher.Target.ASSEMBLY:
return self.assigned_assembly
if self.voucher.target == Voucher.Target.USER:
......@@ -218,7 +218,7 @@ class VoucherEntry(models.Model):
else:
# assembly assigned without a timestamp?
if self.voucher.target in Voucher.ASSEMBLY_TARGETS and self.assigned_assembly is not None:
if self.voucher.target == Voucher.Target.ASSEMBLY and self.assigned_assembly is not None:
self.assigned = timezone.now()
else:
self.assigned_assembly = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment