Skip to content

Commit

Permalink
define weight in terms of parent
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Oct 30, 2024
1 parent 787304a commit 2594c7a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions postcode_lookup/template_sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,8 @@ def __init__(self, *args, **kwargs) -> None:

@property
def weight(self):
if self.timetable.is_before(TimetableEvent.REGISTRATION_DEADLINE):
return -5999

if self.timetable.is_after(TimetableEvent.REGISTRATION_DEADLINE):
return 1002
return 0
parent_weight = super().weight
return 0 if parent_weight == 0 else parent_weight + 1

@property
def context(self):
Expand Down

0 comments on commit 2594c7a

Please sign in to comment.