Changeset - 20469223cb05
[Not reviewed]
0 1 0
Clinton Roy - 5 years ago 2019-10-19 01:38:29
clintonr@ansto.gov.au
go from proposal, to presentation, to slot, to slotroom.
1 file changed with 17 insertions and 26 deletions:
0 comments (0 inline, 0 general)
pinaxcon/registrasion/management/commands/update_schedule.py
Show inline comments
...
 
@@ -116,33 +116,11 @@ class Command(BaseCommand):
 
            slotkind, _created = SlotKind.objects.get_or_create(schedule=schedule, label=slotkind_name)
 
            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():
 
            date, kindslot, room = details
 
            date, kindslot, room_name = details
 
            kind_name = kindslot.rsplit(' ', 1)[0]
 

	
 
            (start_time, end_time) = slot_details[(date, kindslot, room)]
 

	
 
            slot = slots[(date, kind_name, start_time, end_time)]
 

	
 
            slotroom = SlotRoom.objects.get_or_create(slot=slot, room=rooms[room])
 
            (start_time, end_time) = slot_details[(date, kindslot, room_name)]
 

	
 
            proposal = ProposalBase.objects.filter(pk=talk_id).first()
 

	
...
 
@@ -150,7 +128,20 @@ class Command(BaseCommand):
 

	
 
            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()
 

	
 
            slotroom, _create = SlotRoom.objects.get_or_create(slot=preso.slot, room=rooms[room_name])
0 comments (0 inline, 0 general)