diff --git a/app/career/views/weekly_business.py b/app/career/views/weekly_business.py index 657c3af0..80baeffc 100644 --- a/app/career/views/weekly_business.py +++ b/app/career/views/weekly_business.py @@ -59,7 +59,7 @@ def create(self, request, *args, **kwargs): except ValueError: return Response( {"detail": "En feil oppstod under behandlingen av forespørselen."}, - status=status.HTTP_400_BAD_REQUEST + status=status.HTTP_400_BAD_REQUEST, ) def update(self, request, pk): @@ -81,7 +81,7 @@ def update(self, request, pk): except ValueError: return Response( {"detail": "En feil oppstod under behandlingen av forespørselen."}, - status=status.HTTP_400_BAD_REQUEST + status=status.HTTP_400_BAD_REQUEST, ) def destroy(self, request, *args, **kwargs): diff --git a/app/content/serializers/event.py b/app/content/serializers/event.py index c97704df..66182916 100644 --- a/app/content/serializers/event.py +++ b/app/content/serializers/event.py @@ -1,4 +1,3 @@ -from django.db.models import Q from rest_framework import serializers from dry_rest_permissions.generics import DRYPermissionsField @@ -326,6 +325,7 @@ def get_allow_photo_count(self, obj, *args, **kwargs): def get_has_not_paid_count(self, obj, *args, **kwargs): if obj.is_paid_event: - orders = obj.orders.filter(~Q(status=OrderStatus.SALE), event=obj).count() - return orders + registrations = obj.registrations.filter(is_on_wait=False).count() + orders = obj.orders.filter(status=OrderStatus.SALE, event=obj).count() + return registrations - orders return 0 diff --git a/app/content/views/upload.py b/app/content/views/upload.py index b9816e43..d5c9d8b2 100644 --- a/app/content/views/upload.py +++ b/app/content/views/upload.py @@ -35,7 +35,7 @@ def upload(request): except ValueError: return Response( {"detail": "En feil oppstod under behandlingen av forespørselen."}, - status=status.HTTP_400_BAD_REQUEST + status=status.HTTP_400_BAD_REQUEST, ) @@ -56,5 +56,5 @@ def delete(_request, container_name, blob_name): except ValueError: return Response( {"detail": "En feil oppstod under behandlingen av forespørselen."}, - status=status.HTTP_400_BAD_REQUEST + status=status.HTTP_400_BAD_REQUEST, ) diff --git a/requirements.txt b/requirements.txt index 20aa30f0..7f1d547f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -44,7 +44,7 @@ isort flake8 flake8-django flake8-black -pre-commit == 3.8.0 +pre-commit == 4.0.1 # Testing # ------------------------------------------------------------------------------