Allow multiple allocations for a topic

Support creation of disjoint slots for a given topic, to support the new
"scattered" topic layout we plan to use for HK.

Change-Id: I9bd382c05234a58a162dbcbb7efced396d0ff7e9
This commit is contained in:
Thierry Carrez 2013-08-05 14:41:25 +02:00
parent e340d96d6d
commit cecd79f1c5
2 changed files with 8 additions and 6 deletions

View File

@ -44,9 +44,9 @@ class Command(BaseCommand):
r = Room(code=roomcode, name=roomdesc) r = Room(code=roomcode, name=roomdesc)
r.save() r.save()
for topicname, desc in data['topics'].iteritems(): for desc in data['allocations']:
started = False started = False
t = Topic.objects.get(name=topicname) t = Topic.objects.get(name=desc['topic'])
room = Room.objects.get(code=desc['room']) room = Room.objects.get(code=desc['room'])
for (d, h) in slot_generator(data): for (d, h) in slot_generator(data):
if (d == desc['start_day'] and h == desc['first_slot']): if (d == desc['start_day'] and h == desc['first_slot']):

View File

@ -21,10 +21,12 @@
] ]
} }
], ],
"topics": { "allocations": [
"Swift": { {
"topic": "Swift",
"room": "A", "room": "A",
"start_day": "2012-09-20", "first_slot": "09:30", "start_day": "2012-09-20", "first_slot": "09:30",
"end_day": "2012-09-21", "last_slot": "10:00" } "end_day": "2012-09-21", "last_slot": "10:00"
} }
]
} }