Skip to content

Commit

Permalink
Merge pull request #112 from dudtlstm/main
Browse files Browse the repository at this point in the history
🩹 Fix: 부스 리스트에서도 status 3개만 포함하게 수정
  • Loading branch information
dudtlstm authored Oct 8, 2024
2 parents 2ba4aa1 + b33642e commit c66483c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions booth/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.response import Response
from django.db.models import Case, When, Value, IntegerField, Count
from django.db.models import Case, When, Value, IntegerField, Count, Q
from rest_framework.filters import OrderingFilter
from .models import Booth
from .serializers import BoothListSerializer, BoothDetailSerializer
Expand All @@ -24,7 +24,8 @@ def get_serializer_class(self):
def get_queryset(self):
# 운영 상태에 따른 정렬 우선순위 설정 ! '운영 중 - 대기 중지 - 운영 전 - 운영종료' 순
queryset = Booth.objects.annotate(
waiting_count=Count('waitings'),
# 'waiting', 'ready_to_confirm', 'confirmed' 상태만 카운트 !!!
waiting_count=Count('waitings', filter=Q(waitings__waiting_status__in=['waiting', 'ready_to_confirm', 'confirmed'])),
is_operated_order=Case(
When(is_operated='operating', then=Value(1)),
When(is_operated='paused', then=Value(2)),
Expand Down

0 comments on commit c66483c

Please sign in to comment.