fix - transaction dashboard items filter
This commit is contained in:
@@ -31,7 +31,7 @@ class TransactionDashboardService:
|
||||
transaction__seller_organization__in=orgs_child
|
||||
).select_related("gov_product", "free_product")
|
||||
|
||||
# filter queryset by date
|
||||
# filter queryset (transactions & items) by date
|
||||
if start_date and end_date:
|
||||
transactions = DynamicSearchService(
|
||||
queryset=transactions,
|
||||
@@ -40,9 +40,17 @@ class TransactionDashboardService:
|
||||
date_field="create_date",
|
||||
).apply()
|
||||
|
||||
items = DynamicSearchService(
|
||||
queryset=items,
|
||||
start=start_date,
|
||||
end=end_date,
|
||||
date_field="create_date",
|
||||
).apply()
|
||||
|
||||
# filer by transaction status
|
||||
if status:
|
||||
transactions = transactions.filter(transaction_status=status)
|
||||
items = items.filter(transaction__transaction_status=status)
|
||||
|
||||
transaction_stats = transactions.aggregate(
|
||||
total_transactions=Count("id"),
|
||||
|
||||
Reference in New Issue
Block a user