mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:02:20 +01:00
Use southern style queue limit
This commit is contained in:
@ -112,12 +112,12 @@ LOGOUT_REDIRECT_URL = '/'
|
|||||||
|
|
||||||
BERTHA_HOST = ('bach.science.ru.nl', 1234)
|
BERTHA_HOST = ('bach.science.ru.nl', 1234)
|
||||||
MAIL_FROM = 'marietje@marietje.science.ru.nl'
|
MAIL_FROM = 'marietje@marietje.science.ru.nl'
|
||||||
MAX_MINUTES_IN_A_ROW = 20
|
MAX_MINUTES_IN_A_ROW = 45
|
||||||
|
|
||||||
# Time range (dependent on timezone specified) when MAX_MINUTES_IN_A_ROW is in effect.
|
# Time range (dependent on timezone specified) when MAX_MINUTES_IN_A_ROW is in effect.
|
||||||
LIMIT_HOURS = (12, 13)
|
LIMIT_HOURS = (12, 13)
|
||||||
LIMIT_MINUTES = (15, 45)
|
LIMIT_MINUTES = (15, 45)
|
||||||
LIMIT_ALWAYS = 45
|
LIMIT_ALWAYS = True
|
||||||
|
|
||||||
CONTACT_EMAIL = 'marietje@science.ru.nl'
|
CONTACT_EMAIL = 'marietje@science.ru.nl'
|
||||||
|
|
||||||
|
|||||||
@ -112,13 +112,7 @@ class Queue(models.Model):
|
|||||||
|
|
||||||
def request(self, song, user):
|
def request(self, song, user):
|
||||||
playlist_songs = PlaylistSong.objects.filter(playlist=self.playlist, state=0).order_by('id')
|
playlist_songs = PlaylistSong.objects.filter(playlist=self.playlist, state=0).order_by('id')
|
||||||
|
seconds_in_a_row = sum(ps.song.duration for ps in playlist_songs if ps.user == user)
|
||||||
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
|
|
||||||
|
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if not user.is_superuser:
|
if not user.is_superuser:
|
||||||
|
|||||||
Reference in New Issue
Block a user