summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-09-28 10:56:23 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-09-28 10:57:23 (GMT)
commitddf7868b83e5317de871c267eeb477deeaa77b6e (patch)
tree2d132a698ceb37c1817ad65636f1ec7f8818d974 /program
parentf7f76cef63b6a274d3f5836b53508f343840d089 (diff)
always return first specials timeslot
Diffstat (limited to 'program')
-rw-r--r--program/views.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/program/views.py b/program/views.py
index a9c83e4..3b86b5d 100644
--- a/program/views.py
+++ b/program/views.py
@@ -222,10 +222,16 @@ def json_timeslots_specials(request):
for ts in TimeSlot.objects.filter(end__gt=datetime.now, programslot__automation_id__in=specials.iterkeys()).select_related('show'):
automation_id = ts.programslot.automation_id
+ start = ts.start.strftime('%Y-%m-%d_%H:%M:%S')
+ end = ts.end.strftime('%Y-%m-%d_%H:%M:%S')
+ if specials[automation_id]['pv_id'] != -1:
+ if specials[automation_id]['pv_start'] < start:
+ continue
+
specials[automation_id]['pv_id'] = int(ts.show.id)
specials[automation_id]['pv_name'] = ts.show.name
- specials[automation_id]['pv_start'] = ts.start.strftime('%Y-%m-%d_%H:%M:%S')
- specials[automation_id]['pv_end'] = ts.end.strftime('%Y-%m-%d_%H:%M:%S')
+ specials[automation_id]['pv_start'] = start
+ specials[automation_id]['pv_end'] = end
return HttpResponse(json.dumps(specials, ensure_ascii=False, encoding='utf8').encode('utf8'),
content_type="application/json; charset=utf-8")