mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:12:23 +01:00
fix all pylint complaints
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@ -1,3 +0,0 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@ -1,4 +1,3 @@
|
||||
from django.db.models import Count, Q
|
||||
from django.http import HttpResponse
|
||||
from django.db.utils import OperationalError
|
||||
|
||||
@ -16,13 +15,12 @@ queue_users_gauge = Gauge('marietje_queue_users', 'Users holding a queue at some
|
||||
try:
|
||||
for queue in Queue.objects.all():
|
||||
def _get_queue_length():
|
||||
return (PlaylistSong.objects.filter(playlist=queue.playlist_id, state=0)
|
||||
.count())
|
||||
return PlaylistSong.objects.filter(playlist=queue.playlist_id, state=0).count()
|
||||
|
||||
def _get_queue_duration():
|
||||
playlist_songs = (PlaylistSong.objects.filter(playlist=queue.playlist_id, state=0)
|
||||
.select_related('song')
|
||||
.all())
|
||||
.select_related('song')
|
||||
.all())
|
||||
return sum(ps.song.duration for ps in playlist_songs)
|
||||
|
||||
def _get_queue_distinct_users():
|
||||
@ -31,7 +29,7 @@ try:
|
||||
# that much of confidence that it would also work on mysql.
|
||||
# Furtermore, we do not expect the queue to be very long at any moment.
|
||||
return len(set(PlaylistSong.objects.filter(playlist=queue.playlist_id, state=0)
|
||||
.values_list('user')))
|
||||
.values_list('user')))
|
||||
|
||||
queue_length_gauge.labels(name=queue).set_function(_get_queue_length)
|
||||
queue_duration_gauge.labels(name=queue).set_function(_get_queue_duration)
|
||||
|
||||
Reference in New Issue
Block a user