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