mirror of https://github.com/veops/cmdb.git
fix dashboard compute
This commit is contained in:
parent
1a7c3fcd21
commit
79f5dac661
|
@ -342,7 +342,7 @@ class CMDBCounterCache(object):
|
||||||
type_ids = custom['options'].get('type_ids') or (type_id and [type_id])
|
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])))
|
attr_ids = list(map(str, custom['options'].get('attr_ids') or (attr_id and [attr_id])))
|
||||||
other_filter = custom['options'].get('filter')
|
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':
|
if custom['options'].get('ret') == 'cis':
|
||||||
query = "_type:({}),{}".format(";".join(map(str, type_ids)), other_filter)
|
query = "_type:({}),{}".format(";".join(map(str, type_ids)), other_filter)
|
||||||
|
|
|
@ -582,7 +582,8 @@ class CITypeRelationManager(object):
|
||||||
|
|
||||||
def get_children(_id, level):
|
def get_children(_id, level):
|
||||||
children = CITypeRelation.get_by(parent_id=_id, to_dict=False)
|
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:
|
for i in children:
|
||||||
if i.child_id != _id:
|
if i.child_id != _id:
|
||||||
|
|
Loading…
Reference in New Issue