Skip to content
Snippets Groups Projects

Encapsulate discretization in Event::discretize_timeslots

Merged Felix Blanke requested to merge feature/encapsulate_discretization_choice into main
+ 2
2
@@ -385,9 +385,9 @@ class Event(models.Model):
def discretize_timeslots(self, *, slots_in_an_hour: float = 1.0) -> Iterable[TimeslotBlock]:
if DefaultSlot.objects.filter(event=self).exists():
# discretize default slots if they exists
yield from merge_blocks(self.default_time_slots(slots_in_an_hour=SLOTS_IN_AN_HOUR))
yield from merge_blocks(self.default_time_slots(slots_in_an_hour=slots_in_an_hour))
else:
yield from self.uniform_time_slots(slots_in_an_hour=SLOTS_IN_AN_HOUR)
yield from self.uniform_time_slots(slots_in_an_hour=slots_in_an_hour)
def schedule_from_json(self, schedule: str) -> None:
"""Load AK schedule from a json string.
Loading