fix - rancher quota weight statistic / link in herds livestock gropes
This commit is contained in:
@@ -14,9 +14,9 @@ from apps.warehouse.models import (
|
||||
)
|
||||
|
||||
LIVESTOCK_GROPES = {
|
||||
'I': 'industrial', # صنعتی
|
||||
'V': 'rural', # روستایی
|
||||
'N': 'nomadic' # عشایری
|
||||
'industrial': 'I', # صنعتی
|
||||
'rural': 'V', # روستایی
|
||||
'nomadic': 'N' # عشایری
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ def rancher_quota_weight(
|
||||
allocations = list(quota.livestock_allocations.all().select_related('livestock_type'))
|
||||
# list of quota incentive plans
|
||||
incentive_plans = list(quota.incentive_assignments.all().select_related('livestock_type'))
|
||||
# list of rancher herds
|
||||
herds = rancher.herd.all()
|
||||
herd_livestock_gropes = [herd.activity for herd in herds]
|
||||
|
||||
livestock_counts_list, livestock_counts_dict = get_rancher_statistics(rancher)
|
||||
|
||||
@@ -94,7 +97,7 @@ def rancher_quota_weight(
|
||||
# calculate quota base weight by livestock type & base total weight
|
||||
for item in allocations: # noqa
|
||||
if item.livestock_type:
|
||||
if rancher.activity and LIVESTOCK_GROPES[rancher.activity] == item.livestock_group:
|
||||
if LIVESTOCK_GROPES[item.livestock_group] in herd_livestock_gropes:
|
||||
animal_type_fa = item.livestock_type.name
|
||||
animal_type_en = item.livestock_type.en_name
|
||||
per_head = item.quantity_kg
|
||||
|
||||
Reference in New Issue
Block a user