From 0b1dfaf020674e9d7f790cc3eb6ca46d4f650906 Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Wed, 20 Mar 2019 10:56:44 +0100 Subject: [PATCH 1/2] Remove executed field from QueueCommand --- marietje/playerapi/views.py | 12 +++++------- marietje/queues/models.py | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/marietje/playerapi/views.py b/marietje/playerapi/views.py index 0db6ed9..ff62c35 100644 --- a/marietje/playerapi/views.py +++ b/marietje/playerapi/views.py @@ -15,18 +15,16 @@ from .decorators import token_required @token_required def queue(request): current_queue = get_object_or_404(Queue, id=request.POST.get('queue')) - - commands = current_queue.queuecommand_set.filter(executed=False) - for command in commands: - command.executed = True - command.save() - - return JsonResponse({ + commands = current_queue.queuecommand_set.all() + response = JsonResponse({ 'current_song': playlist_song_to_dict(current_queue.current_song(), include_hash=True, include_replaygain=True), 'queue': [playlist_song_to_dict(playlist_song, include_hash=True, include_replaygain=True) for playlist_song in current_queue.queue()[:1]], 'commands': [command.command for command in commands] }) + for command in commands: + command.delete() + return response @csrf_exempt @token_required diff --git a/marietje/queues/models.py b/marietje/queues/models.py index a5d567b..ca07298 100644 --- a/marietje/queues/models.py +++ b/marietje/queues/models.py @@ -157,9 +157,9 @@ class QueueCommand(models.Model): queue = models.ForeignKey( Queue, on_delete=models.CASCADE, + db_index=True, ) command = models.TextField() - executed = models.BooleanField(default=False) def __str__(self): return self.command From 58b96cb15922e51db68222899a4f90ca2131b1fb Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Wed, 20 Mar 2019 11:12:30 +0100 Subject: [PATCH 2/2] Revert "Update requirements.txt" This reverts commit 6ae7da5797afaf631df8827b1194268049701af6. However, it adds a new file for requirements on production. --- requirements-production.txt | 7 +++++++ requirements.txt | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 requirements-production.txt diff --git a/requirements-production.txt b/requirements-production.txt new file mode 100644 index 0000000..e3cb23b --- /dev/null +++ b/requirements-production.txt @@ -0,0 +1,7 @@ +setuptools +django==2.1 +mysqlclient +https://projects.unbit.it/downloads/uwsgi-lts.tar.gz +mutagen +argon2-cffi +prometheus_client diff --git a/requirements.txt b/requirements.txt index e3cb23b..cff865b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,4 @@ -setuptools -django==2.1 -mysqlclient -https://projects.unbit.it/downloads/uwsgi-lts.tar.gz +django mutagen argon2-cffi prometheus_client