fix dashboard compute

This commit is contained in:
pycook 2023-09-18 13:04:50 +08:00
parent 1a7c3fcd21
commit 79f5dac661
2 changed files with 3 additions and 2 deletions

View File

@ -342,7 +342,7 @@ class CMDBCounterCache(object):
type_ids = custom['options'].get('type_ids') or (type_id and [type_id])
attr_ids = list(map(str, custom['options'].get('attr_ids') or (attr_id and [attr_id])))
other_filter = custom['options'].get('filter')
other_filter = "({})".format(other_filter) if other_filter else ''
other_filter = "{}".format(other_filter) if other_filter else ''
if custom['options'].get('ret') == 'cis':
query = "_type:({}),{}".format(";".join(map(str, type_ids)), other_filter)

View File

@ -582,7 +582,8 @@ class CITypeRelationManager(object):
def get_children(_id, level):
children = CITypeRelation.get_by(parent_id=_id, to_dict=False)
result[level + 1] = [i.child.to_dict() for i in children]
if children:
result.setdefault(level + 1, []).extend([i.child.to_dict() for i in children])
for i in children:
if i.child_id != _id: