Skip to content
Snippets Groups Projects
Verified Commit 9b43cd66 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

fix: remove remaining references to show Timeslot

parent 34974d83
No related branches found
No related tags found
No related merge requests found
Pipeline #6651 passed
......@@ -147,9 +147,7 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# If no solution necessary: Create the projected timeslot and skip
if "solution_choices" not in timeslot or len(timeslot["collisions"]) == 0:
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], timeslot["end"], new_schedule
),
TimeSlot.objects.instantiate(timeslot["start"], timeslot["end"], new_schedule),
)
continue
......@@ -182,9 +180,7 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# - Create the projected timeslot
# - Delete the existing collision(s)
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], timeslot["end"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], timeslot["end"], new_schedule),
)
# Delete collision(s)
......@@ -198,18 +194,14 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# - Keep the existing timeslot
# - Create projected with end of existing start
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], existing["start"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], existing["start"], new_schedule),
)
if solution == "ours-end":
# - Create the projected timeslot
# - Change the start of the existing collision to projected end
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], timeslot["end"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], timeslot["end"], new_schedule),
)
existing_ts = TimeSlot.objects.get(pk=existing["timeslot_id"])
......@@ -220,16 +212,14 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# - Keep existing
# - Create projected with start time of existing end
to_create.append(
TimeSlot.objects.instantiate(existing["end"], timeslot["end"], new_schedule, show),
TimeSlot.objects.instantiate(existing["end"], timeslot["end"], new_schedule),
)
if solution == "ours-start":
# - Create the projected timeslot
# - Change end of existing to projected start
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], timeslot["end"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], timeslot["end"], new_schedule),
)
existing_ts = TimeSlot.objects.get(pk=existing["timeslot_id"])
......@@ -240,13 +230,11 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# - Keep existing
# - Create two projected timeslots with end of existing start and start of existing end
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], existing["start"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], existing["start"], new_schedule),
)
to_create.append(
TimeSlot.objects.instantiate(existing["end"], timeslot["end"], new_schedule, show),
TimeSlot.objects.instantiate(existing["end"], timeslot["end"], new_schedule),
)
if solution == "ours-both":
......@@ -255,9 +243,7 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
# - Set existing end time to projected start
# - Create another one with start = projected end and end = existing end
to_create.append(
TimeSlot.objects.instantiate(
timeslot["start"], timeslot["end"], new_schedule, show
),
TimeSlot.objects.instantiate(timeslot["start"], timeslot["end"], new_schedule),
)
existing_ts = TimeSlot.objects.get(pk=existing["timeslot_id"])
......@@ -265,7 +251,7 @@ def resolve_conflicts(data: ScheduleCreateUpdateData, schedule_pk: int | None, s
to_update.append(existing_ts)
to_create.append(
TimeSlot.objects.instantiate(timeslot["end"], existing["end"], new_schedule, show),
TimeSlot.objects.instantiate(timeslot["end"], existing["end"], new_schedule),
)
# If there were any errors, don't make any db changes yet
......@@ -641,8 +627,8 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
"start": str(c.start),
"end": str(c.end),
"playlist_id": c.playlist_id,
"show_id": c.show.id,
"show_name": c.show.name,
"show_id": c.schedule.show.id,
"show_name": c.schedule.show.name,
"schedule_id": c.schedule_id,
"memo": c.memo,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment