fix - get_total_used_weight in rancher services
This commit is contained in:
@@ -4,10 +4,11 @@ from django.db.models import Sum, functions, Value
|
||||
class RancherService:
|
||||
|
||||
@staticmethod
|
||||
def get_total_used_weight(rancher, sale_item):
|
||||
def get_total_used_weight(rancher, sale_item, distribution):
|
||||
return sale_item.objects.filter(
|
||||
transaction__rancher=rancher,
|
||||
transaction__transaction_status='success'
|
||||
transaction__transaction_status='success',
|
||||
quota_distribution=distribution,
|
||||
).aggregate(
|
||||
total_weight=functions.Coalesce(Sum('weight'), Value(0))
|
||||
)['total_weight']
|
||||
|
||||
Reference in New Issue
Block a user