Merged in feature/PYPE-124_hierarchical_attributes (pull request #42)

added hierarchical check for custom attrbiutes

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Jakub Trllo 2019-01-11 12:53:26 +00:00 committed by Milan Kolar
commit 09c38da4e3

View file

@ -39,13 +39,20 @@ def get_data(parent, entity, session, custom_attributes):
for cust_attr in custom_attributes:
key = cust_attr['key']
if cust_attr['entity_type'].lower() in ['asset']:
if (
cust_attr['is_hierarchical'] is True or
cust_attr['entity_type'].lower() in ['asset'] or
(
cust_attr['entity_type'].lower() in ['show'] and
entity_type.lower() == 'project'
)
):
data[key] = entity['custom_attributes'][key]
elif cust_attr['entity_type'].lower() in ['show'] and entity_type.lower() == 'project':
data[key] = entity['custom_attributes'][key]
elif cust_attr['entity_type'].lower() in ['task'] and entity_type.lower() != 'project':
elif (
cust_attr['entity_type'].lower() in ['task'] and
entity_type.lower() != 'project'
):
# Put space between capitals (e.g. 'AssetBuild' -> 'Asset Build')
entity_type_full = re.sub(r"(\w)([A-Z])", r"\1 \2", entity_type)
# Get object id of entity type