go from proposal, to presentation, to slot, to slotroom.
This commit is contained in:
parent
8badb0cb99
commit
20469223cb
1 changed files with 17 additions and 26 deletions
|
@ -116,33 +116,11 @@ class Command(BaseCommand):
|
||||||
slotkind, _created = SlotKind.objects.get_or_create(schedule=schedule, label=slotkind_name)
|
slotkind, _created = SlotKind.objects.get_or_create(schedule=schedule, label=slotkind_name)
|
||||||
slotkinds[slotkind_name] = slotkind
|
slotkinds[slotkind_name] = slotkind
|
||||||
|
|
||||||
slots = {}
|
|
||||||
for details in slot_details:
|
|
||||||
date, kindslot, room = details
|
|
||||||
start_time, end_time = slot_details[details]
|
|
||||||
|
|
||||||
kind_name = kindslot.rsplit(' ', 1)[0]
|
|
||||||
|
|
||||||
# TODO this should not be hard coded
|
|
||||||
exclusive = kind_name in ["plenary", "morning tea", "afternoon tea"]
|
|
||||||
|
|
||||||
slot, _created = Slot.objects.get_or_create(
|
|
||||||
day=days[date],
|
|
||||||
kind=slotkinds[kind_name],
|
|
||||||
start=start_time, end=end_time,
|
|
||||||
exclusive=exclusive)
|
|
||||||
|
|
||||||
slots[(date, kind_name, start_time, end_time)] = slot
|
|
||||||
|
|
||||||
for details, talk_id in talks.items():
|
for details, talk_id in talks.items():
|
||||||
date, kindslot, room = details
|
date, kindslot, room_name = details
|
||||||
kind_name = kindslot.rsplit(' ', 1)[0]
|
kind_name = kindslot.rsplit(' ', 1)[0]
|
||||||
|
|
||||||
(start_time, end_time) = slot_details[(date, kindslot, room)]
|
(start_time, end_time) = slot_details[(date, kindslot, room_name)]
|
||||||
|
|
||||||
slot = slots[(date, kind_name, start_time, end_time)]
|
|
||||||
|
|
||||||
slotroom = SlotRoom.objects.get_or_create(slot=slot, room=rooms[room])
|
|
||||||
|
|
||||||
proposal = ProposalBase.objects.filter(pk=talk_id).first()
|
proposal = ProposalBase.objects.filter(pk=talk_id).first()
|
||||||
|
|
||||||
|
@ -150,7 +128,20 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
preso = Presentation.objects.filter(proposal_base=proposal).first()
|
preso = Presentation.objects.filter(proposal_base=proposal).first()
|
||||||
|
|
||||||
print(f'would like to set {preso} to slot {slot}')
|
assert preso, f"Could not find Presentation for talk {talk_id}"
|
||||||
|
|
||||||
|
if not preso.slot:
|
||||||
|
|
||||||
|
# TODO the exclusive list should not be hard coded, another csv file maybe.
|
||||||
|
exclusive = kind_name in ["plenary", "morning tea", "lunch", "afternoon tea"]
|
||||||
|
|
||||||
|
preso.slot, _created = Slot.objects.get_or_create(
|
||||||
|
day=days[date],
|
||||||
|
kind=slotkinds[kind_name],
|
||||||
|
start=start_time,
|
||||||
|
end=end_time,
|
||||||
|
exclusive=exclusive)
|
||||||
|
|
||||||
#preso.slot = slot
|
|
||||||
preso.save()
|
preso.save()
|
||||||
|
|
||||||
|
slotroom, _create = SlotRoom.objects.get_or_create(slot=preso.slot, room=rooms[room_name])
|
||||||
|
|
Loading…
Reference in a new issue