set to get rancher_inventory - change serializer to check context

This commit is contained in:
2025-08-30 10:34:20 +03:30
parent 390f1afe74
commit 29025235d5
4 changed files with 24 additions and 6 deletions

View File

@@ -57,8 +57,9 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
'id': instance.distribution.quota.product.id,
}
# rancher herd & live stock statistics
representation['rancher_statistics'] = get_rancher_statistics(self.context['rancher'])
if self.context['rancher']:
# rancher herd & live stock statistics
representation['rancher_statistics'] = get_rancher_statistics(self.context['rancher'])
# rancher live stock statistics by inventory entry
representation['rancher_quota_weight_statistics'] = rancher_quota_weight(