change incentive plans total weight quota with rancher incentive plan - change id to rancher plan and add incentive plan id

This commit is contained in:
2025-09-25 12:16:49 +03:30
parent 10ff4de7ed
commit 8571ef0c68
6 changed files with 102 additions and 33 deletions

View File

@@ -47,13 +47,14 @@ def quota_incentive_plans_info(quota: Quota, rancher: Rancher) -> typing.Any:
).filter(rancher=rancher, livestock_type=plan.livestock_type)
incentive_plans_data = {
'id': plan.incentive_plan.id,
'id': rancher_plan.first().allowed_quantity,
'name': plan.incentive_plan.name,
'livestock_type': plan.livestock_type.name if plan.livestock_type else "",
'livestock_type_en': plan.livestock_type.en_name if plan.livestock_type else "",
'livestock_weight_type': plan.livestock_type.weight_type if plan.livestock_type else "",
'quantity_kg': plan.quantity_kg,
'rancher_license_count': rancher_plan.first().allowed_quantity if rancher_plan else 0,
"incentive_plan": plan.incentive_plan.id
}
incentive_plans_list.append(incentive_plans_data)