chore: workspace estimate project filter (#4070)

This commit is contained in:
Bavisetti Narayan 2024-03-26 16:59:23 +05:30 committed by GitHub
parent f3fd48dd43
commit 1c3619a4d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,15 +25,11 @@ class WorkspaceEstimatesEndpoint(BaseAPIView):
estimate_ids = Project.objects.filter( estimate_ids = Project.objects.filter(
workspace__slug=slug, estimate__isnull=False workspace__slug=slug, estimate__isnull=False
).values_list("estimate_id", flat=True) ).values_list("estimate_id", flat=True)
estimates = Estimate.objects.filter( estimates = (
pk__in=estimate_ids Estimate.objects.filter(pk__in=estimate_ids, workspace__slug=slug)
).prefetch_related( .prefetch_related("points")
Prefetch( .select_related("workspace", "project")
"points",
queryset=Project.objects.select_related(
"estimate", "workspace"
),
)
) )
serializer = WorkspaceEstimateSerializer(estimates, many=True) serializer = WorkspaceEstimateSerializer(estimates, many=True)
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)