From 95965cbfb1d61a8b74730307b40ca16ac995963c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:08:27 +0100 Subject: [PATCH 1/2] chore(deps): Bump pre-commit from 3.8.0 to 4.0.1 (#899) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.8.0 to 4.0.1. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.8.0...v4.0.1) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 # ------------------------------------------------------------------------------ From b5670f00c8326e225ae7a453780f715844b72471 Mon Sep 17 00:00:00 2001 From: Yazan Zarka Date: Tue, 29 Oct 2024 15:37:06 +0100 Subject: [PATCH 2/2] Feat(registration)/filter participants (#917) Fixed bugs introduced in an earlier pr --------- Co-authored-by: Harry Linrui XU Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com> Co-authored-by: haruixu <114171733+haruixu@users.noreply.github.com> --- app/career/views/weekly_business.py | 4 ++-- app/content/serializers/event.py | 6 +++--- app/content/views/upload.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) 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, )