fixed schedule slot room ordering

This commit is contained in:
Brian Rosner 2012-09-19 20:48:54 -06:00
parent 796a8c98ba
commit b7e8e7da8c
2 changed files with 6 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import itertools
import operator
from django.db.models import Count
from django.db.models import Count, Min
from symposion.schedule.models import Room, Slot, SlotRoom
@ -25,8 +25,9 @@ class TimeTable(object):
def __iter__(self):
times = sorted(set(itertools.chain(*self.slots_qs().values_list("start", "end"))))
slots = Slot.objects.filter(pk__in=self.slots_qs().order_by("start", "slotroom__room__order").values("pk"))
slots = slots.annotate(room_count=Count("slotroom"))
slots = Slot.objects.filter(pk__in=self.slots_qs().values("pk"))
slots = slots.annotate(room_count=Count("slotroom"), order=Min("slotroom__room__order"))
slots = slots.order_by("start", "order")
row = []
for time, next_time in pairwise(times):
row = {"time": time, "slots": []}

View file

@ -12,9 +12,10 @@
<td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{{ slow.rowspan }}">
{% if slot.kind.label == "talk" %}
{% if not slot.content %}
<a class="btn btn-mini edit-slot" data-action="{% url schedule_slot_edit schedule.section.slug slot.pk %}" href="#">+</a>
<a class="btn btn-mini edit-slot" data-action="{% url schedule_slot_edit schedule.section.slug slot.pk %}" href="#">+</a><br />{{ slot.rooms|join:", " }}
{% else %}
<div class="title"><a class="edit-slot" data-action="{% url schedule_slot_edit schedule.section.slug slot.pk %}" href="#">{{ slot.content.title }}</a></div>
<div>{{ slot.rooms|join:", " }}</div>
<div class="speaker">{{ slot.content.speaker }}</div>
{% endif %}
{% else %}