Skip to content

Commit

Permalink
Feat(registration)/filter participants (#917)
Browse files Browse the repository at this point in the history
Fixed bugs introduced in an earlier pr

---------

Co-authored-by: Harry Linrui XU <[email protected]>
Co-authored-by: Mads Nylund <[email protected]>
Co-authored-by: haruixu <[email protected]>
  • Loading branch information
4 people authored Oct 29, 2024
1 parent 95965cb commit b5670f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/career/views/weekly_business.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions app/content/serializers/event.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.db.models import Q
from rest_framework import serializers

from dry_rest_permissions.generics import DRYPermissionsField
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/content/views/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand All @@ -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,
)

0 comments on commit b5670f0

Please sign in to comment.