Use southern style queue limit

This commit is contained in:
Daan Sprenkels
2018-04-09 18:06:12 +02:00
parent 7daacc50bb
commit dfd4752dea
2 changed files with 3 additions and 9 deletions

View File

@ -112,13 +112,7 @@ class Queue(models.Model):
def request(self, song, user):
playlist_songs = PlaylistSong.objects.filter(playlist=self.playlist, state=0).order_by('id')
seconds_in_a_row = 0
for playlist_song in playlist_songs:
if playlist_song.user != user:
seconds_in_a_row = 0
else:
seconds_in_a_row += playlist_song.song.duration
seconds_in_a_row = sum(ps.song.duration for ps in playlist_songs if ps.user == user)
now = timezone.now()
if not user.is_superuser: