import - rancher page main dashboard

This commit is contained in:
2025-12-14 11:28:10 +03:30
parent 057df1b459
commit bf1335b6f2
3 changed files with 66 additions and 40 deletions

View File

@@ -90,6 +90,7 @@ def rancher_quota_weight(
:param inventory_entry: InventoryEntry instance
:param distribution: QuotaDistribution instance
:param quota: Quota instance
:param quota_stat: OrganizationQuotaStat instance
:return: dict {total, by_type}
"""
@@ -115,7 +116,6 @@ def rancher_quota_weight(
# list of rancher herds
herds = rancher.herd.all()
herd_livestock_gropes = [herd.activity if herd.activity else 'V' for herd in herds]
print(herd_livestock_gropes)
livestock_counts_list, livestock_counts_dict = get_rancher_statistic_by_herd(rancher)
total_weight = 0
@@ -153,14 +153,12 @@ def rancher_quota_weight(
# incentive plan quantity by this livestock type
rancher_plan_weight = rancher_plans.first().allowed_quantity * item.quantity_kg
total_weight += rancher_plan_weight
print(total_weight)
# get rancher remaining usage of quota for purchase
rancher_remaining_usage = RancherService.get_total_used_weight(
rancher,
InventoryQuotaSaleItem,
quota_stat=quota_stat
)
print(rancher_remaining_usage)
if total_weight - rancher_remaining_usage < 0:
remaining_weight = 0