Skip to content
Snippets Groups Projects
Commit d5d5bd3d authored by Felix Blanke's avatar Felix Blanke
Browse files

Prefetch in test and fix typing

parent 1b221e11
Branches
No related tags found
1 merge request!268Merge fork for interoperability of KoMa solver
......@@ -183,7 +183,7 @@ class AvailabilitiesFormMixin(forms.Form):
for avail in availabilities:
setattr(avail, reference_name, instance.id)
def _replace_availabilities(self, instance, availabilities: [Availability]):
def _replace_availabilities(self, instance, availabilities: list[Availability]):
"""
Replace the existing list of availabilities belonging to an entity with a new, updated one
......
......@@ -78,7 +78,13 @@ class JSONExportTest(TestCase):
for participant in self.export_dict["participants"]
}
self.ak_slots = AKSlot.objects.filter(event__slug=event.slug).all()
self.ak_slots = (
AKSlot.objects.filter(event__slug=event.slug)
.select_related("ak")
.prefetch_related("ak__conflicts")
.prefetch_related("ak__prerequisites")
.all()
)
self.rooms = Room.objects.filter(event__slug=event.slug).all()
self.slots_in_an_hour = 1 / self.export_dict["timeslots"]["info"]["duration"]
self.event = event
......@@ -563,7 +569,7 @@ class JSONExportTest(TestCase):
# test if time availability of room is restricted
if not Availability.is_event_covered(
room.event, room.availabilities.all()
event, room.availabilities.all()
):
time_constraints.add(f"availability-room-{room.pk}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment