fix - dashboard quota filter by date
This commit is contained in:
@@ -3,7 +3,6 @@ from django.db.models import Sum, Count, Q
|
||||
from django.db.models.functions import Coalesce
|
||||
|
||||
from apps.authentication.models import Organization
|
||||
from apps.authentication.services.service import get_all_org_child
|
||||
from apps.core.services.filter.search import DynamicSearchService
|
||||
from apps.product.models import OrganizationQuotaStats, QuotaDistribution
|
||||
|
||||
@@ -16,14 +15,12 @@ class QuotaDashboardService:
|
||||
@staticmethod
|
||||
def get_dashboard(self, org: Organization, start_date: str = None, end_date: str = None,
|
||||
search_fields: list[str] = None, quota_is_closed: bool = False):
|
||||
orgs_child = get_all_org_child(org=org)
|
||||
orgs_child.append(org)
|
||||
|
||||
if org.type.key == 'ADM':
|
||||
org_quota_stats = OrganizationQuotaStats.objects.filter(quota__is_closed=quota_is_closed, )
|
||||
org_quota_stats = OrganizationQuotaStats.objects.filter(stat_type='quota', quota__is_closed=quota_is_closed)
|
||||
else:
|
||||
org_quota_stats = OrganizationQuotaStats.objects.filter(
|
||||
organization__in=orgs_child,
|
||||
organization=org,
|
||||
quota__is_closed=quota_is_closed,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user