[Update] 修复任务列表,执行历史中stat汇总数据显示问题

pull/4008/head
Bai 5 years ago
parent 728e4b7edd
commit 96afd82341

@ -19,10 +19,13 @@ class AdHocExecutionSerializer(serializers.ModelSerializer):
@staticmethod @staticmethod
def get_stat(obj): def get_stat(obj):
count_failed_hosts = len(obj.failed_hosts)
count_success_hosts = len(obj.success_hosts)
count_total = count_success_hosts + count_failed_hosts
return { return {
"total": obj.hosts_amount, "total": count_total,
"success": len(obj.summary.get("contacted", [])), "success": count_success_hosts,
"failed": len(obj.summary.get("dark", [])), "failed": count_failed_hosts
} }
def get_field_names(self, declared_fields, info): def get_field_names(self, declared_fields, info):

Loading…
Cancel
Save