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