temp fix for on_air's logs
This commit is contained in:
parent
6c2d3feb35
commit
cf988df48f
|
@ -278,6 +278,8 @@ class Station(Nameable):
|
||||||
# each to put them too there
|
# each to put them too there
|
||||||
items = []
|
items = []
|
||||||
diff_ = None
|
diff_ = None
|
||||||
|
now = tz.now()
|
||||||
|
logs = logs.order_by('-date')
|
||||||
for diff in diffs.order_by('-start'):
|
for diff in diffs.order_by('-start'):
|
||||||
logs_ = \
|
logs_ = \
|
||||||
logs.filter(date__gt = diff.end, date__lt = diff_.start) \
|
logs.filter(date__gt = diff.end, date__lt = diff_.start) \
|
||||||
|
@ -287,14 +289,15 @@ class Station(Nameable):
|
||||||
# a log can be started before the end of the diffusion and
|
# a log can be started before the end of the diffusion and
|
||||||
# still is running => need to add it to the list and change
|
# still is running => need to add it to the list and change
|
||||||
# the start date
|
# the start date
|
||||||
partial_log = logs.filter(
|
if diff.end < now:
|
||||||
date__gt = diff.start, date__lt = diff.end
|
partial_log = logs.filter(
|
||||||
).last()
|
date__gt = diff.start, date__lt = diff.end
|
||||||
if partial_log:
|
).last()
|
||||||
next_log = logs.filter(pk__gt = partial_log.pk).first()
|
if partial_log:
|
||||||
if not next_log or next_log.date > diff.date:
|
next_log = logs.filter(pk__gt = partial_log.pk).first()
|
||||||
partial_log.date = diff.end
|
if not next_log or next_log.date > diff.date:
|
||||||
logs_ = [partial_log] + list(logs_[:count])
|
partial_log.date = diff.end
|
||||||
|
logs_ = [partial_log] + list(logs_[:count])
|
||||||
|
|
||||||
# append to list
|
# append to list
|
||||||
diff_ = diff
|
diff_ = diff
|
||||||
|
@ -337,9 +340,7 @@ class Station(Nameable):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
logs = Log.objects.get_for(model = Track) \
|
logs = Log.objects.get_for(model = Track) \
|
||||||
.filter(station = self) \
|
.filter(station = self)
|
||||||
.order_by('-date')
|
|
||||||
|
|
||||||
if date:
|
if date:
|
||||||
logs = logs.filter(date__contains = date)
|
logs = logs.filter(date__contains = date)
|
||||||
diffs = Diffusion.objects.get_at(date)
|
diffs = Diffusion.objects.get_at(date)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user