forked from rc/aircox
logs
This commit is contained in:
@ -64,13 +64,14 @@ class DiffusionQuerySet(BaseRerunQuerySet):
|
||||
""" On air diffusions """
|
||||
return self.filter(type=Diffusion.TYPE_ON_AIR)
|
||||
|
||||
# TODO: rename to `datetime`
|
||||
def now(self, now=None, order=True):
|
||||
""" Diffusions occuring now """
|
||||
now = now or tz.now()
|
||||
qs = self.filter(start__lte=now, end__gte=now).distinct()
|
||||
return qs.order_by('start') if order else qs
|
||||
|
||||
def today(self, today=None, order=True):
|
||||
def date(self, today=None, order=True):
|
||||
""" Diffusions occuring today. """
|
||||
today = today or datetime.date.today()
|
||||
start = tz.datetime.combine(today, datetime.time())
|
||||
|
@ -24,7 +24,7 @@ class LogQuerySet(models.QuerySet):
|
||||
return self.filter(station=station) if id is None else \
|
||||
self.filter(station_id=id)
|
||||
|
||||
def today(self, date):
|
||||
def date(self, date):
|
||||
return self.filter(date__date=date)
|
||||
|
||||
def after(self, date):
|
||||
@ -133,7 +133,7 @@ class LogQuerySet(models.QuerySet):
|
||||
if os.path.exists(path) and not force:
|
||||
return -1
|
||||
|
||||
qs = self.station(station).today(date)
|
||||
qs = self.station(station).date(date)
|
||||
|
||||
if not qs.exists():
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user