change structure of rancher distributions incentive plans data

This commit is contained in:
2025-09-24 11:24:35 +03:30
parent d0db6c9693
commit b771e55bd9

View File

@@ -48,14 +48,11 @@ def quota_incentive_plans_info(quota: Quota, rancher: Rancher) -> typing.Any:
incentive_plans_data = { incentive_plans_data = {
'name': plan.incentive_plan.name, 'name': plan.incentive_plan.name,
'heavy_value': plan.heavy_value,
'light_value': plan.light_value,
'livestock_type': plan.livestock_type.name if plan.livestock_type else "", '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 "", 'livestock_weight_type': plan.livestock_type.weight_type if plan.livestock_type else "",
'quantity_kg': plan.quantity_kg, 'quantity_kg': plan.quantity_kg,
'rancher_plan_statistic': { 'rancher_license_count': rancher_plan.first().allowed_quantity if rancher_plan else 0,
f'{rancher_plan.first().livestock_type.en_name}': rancher_plan.first().allowed_quantity
} if rancher_plan else {}
} }
incentive_plans_list.append(incentive_plans_data) incentive_plans_list.append(incentive_plans_data)