fix - close oe unclose quota in dashboeard
This commit is contained in:
@@ -369,15 +369,20 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, QuotaDashboardService, viewsets
|
||||
|
||||
query_param = self.request.query_params # noqa
|
||||
|
||||
# filter by date
|
||||
start_date = query_param.get('start') if 'start' in query_param.keys() else None
|
||||
end_date = query_param.get('end') if 'end' in query_param.keys() else None
|
||||
|
||||
# filter by quota is close or open
|
||||
is_closed = True if 'is_closed' in query_param.keys() else False
|
||||
|
||||
quota_dashboard = self.get_dashboard(
|
||||
self,
|
||||
org=get_organization_by_user(request.user),
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
search_fields=self.search_fields,
|
||||
quota_is_closed=is_closed
|
||||
)
|
||||
|
||||
return Response(quota_dashboard)
|
||||
@@ -401,9 +406,13 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, QuotaDashboardService, viewsets
|
||||
start_date = query_param.get('start') if 'start' in query_param.keys() else None
|
||||
end_date = query_param.get('end') if 'end' in query_param.keys() else None
|
||||
|
||||
# filter by quota is close or open
|
||||
is_closed = True if 'is_closed' in query_param.keys() else False
|
||||
|
||||
# get organization quota stats and get product ids
|
||||
org_quota_stat = OrganizationQuotaStats.objects.select_related('organization', 'quota').filter(
|
||||
organization=org
|
||||
organization=org,
|
||||
quota__is_closed=is_closed
|
||||
) if not org.type.key == 'ADM' else OrganizationQuotaStats.objects.select_related('organization', 'quota').all()
|
||||
|
||||
products = {f'{stat.quota.product.name}': stat.quota.product.id for stat in org_quota_stat}
|
||||
|
||||
Reference in New Issue
Block a user