Add history funtions for song requests.

This commit is contained in:
RecursiveGreen 2018-03-29 22:58:06 -04:00
parent 311f744d62
commit 7d4446c5b2

View file

@ -9,5 +9,14 @@ class RequestManager(models.Manager):
return self.get_queryset().filter(queued_at__isnull=True, return self.get_queryset().filter(queued_at__isnull=True,
played_at__isnull=True) played_at__isnull=True)
def played(self):
return self.get_queryset().filter(models.Q(queued_at__isnull=False) |
models.Q(played_at__isnull=False))
def get_played_requests(self, limit=None):
if limit:
return self.played()[0:limit]
return self.played()
def next_request(self): def next_request(self):
return self.unplayed().earliest('created_date') return self.unplayed().earliest('created_date')