fixed schedule slot room ordering
This commit is contained in:
		
							parent
							
								
									796a8c98ba
								
							
						
					
					
						commit
						b7e8e7da8c
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		|  | @ -1,7 +1,7 @@ | ||||||
| import itertools | import itertools | ||||||
| import operator | import operator | ||||||
| 
 | 
 | ||||||
| from django.db.models import Count | from django.db.models import Count, Min | ||||||
| 
 | 
 | ||||||
| from symposion.schedule.models import Room, Slot, SlotRoom | from symposion.schedule.models import Room, Slot, SlotRoom | ||||||
| 
 | 
 | ||||||
|  | @ -25,8 +25,9 @@ class TimeTable(object): | ||||||
|      |      | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         times = sorted(set(itertools.chain(*self.slots_qs().values_list("start", "end")))) |         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 = Slot.objects.filter(pk__in=self.slots_qs().values("pk")) | ||||||
|         slots = slots.annotate(room_count=Count("slotroom")) |         slots = slots.annotate(room_count=Count("slotroom"), order=Min("slotroom__room__order")) | ||||||
|  |         slots = slots.order_by("start", "order") | ||||||
|         row = [] |         row = [] | ||||||
|         for time, next_time in pairwise(times): |         for time, next_time in pairwise(times): | ||||||
|             row = {"time": time, "slots": []} |             row = {"time": time, "slots": []} | ||||||
|  |  | ||||||
|  | @ -12,9 +12,10 @@ | ||||||
|                 <td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{{ slow.rowspan }}"> |                 <td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{{ slow.rowspan }}"> | ||||||
|                     {% if slot.kind.label == "talk" %} |                     {% if slot.kind.label == "talk" %} | ||||||
|                         {% if not slot.content %} |                         {% 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 %} |                         {% 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 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> |                             <div class="speaker">{{ slot.content.speaker }}</div> | ||||||
|                         {% endif %} |                         {% endif %} | ||||||
|                     {% else %} |                     {% else %} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Brian Rosner
						Brian Rosner