temp fix for on_air's logs

This commit is contained in:
bkfox 2017-01-09 15:40:28 +01:00
parent 6c2d3feb35
commit cf988df48f

View File

@ -278,6 +278,8 @@ class Station(Nameable):
# each to put them too there
items = []
diff_ = None
now = tz.now()
logs = logs.order_by('-date')
for diff in diffs.order_by('-start'):
logs_ = \
logs.filter(date__gt = diff.end, date__lt = diff_.start) \
@ -287,6 +289,7 @@ class Station(Nameable):
# a log can be started before the end of the diffusion and
# still is running => need to add it to the list and change
# the start date
if diff.end < now:
partial_log = logs.filter(
date__gt = diff.start, date__lt = diff.end
).last()
@ -337,9 +340,7 @@ class Station(Nameable):
return []
logs = Log.objects.get_for(model = Track) \
.filter(station = self) \
.order_by('-date')
.filter(station = self)
if date:
logs = logs.filter(date__contains = date)
diffs = Diffusion.objects.get_at(date)