Skip to content

Commit

Permalink
Merge branch 'develop' into feature/api_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Sep 9, 2024
2 parents ab7a879 + 0dfdcd7 commit 4754567
Show file tree
Hide file tree
Showing 10 changed files with 800 additions and 707 deletions.
18 changes: 17 additions & 1 deletion openatlas/api/endpoints/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def get() -> tuple[Resource, int] | Response | dict[str, Any]:
if exclude := parser.exclude_system_classes:
system_classes = [s for s in system_classes if s not in exclude]
output: dict[str, Any] = defaultdict()
for item in get_all_links_for_network(system_classes):
location_ids = []
links = get_all_links_for_network(system_classes)
for item in links:
if output.get(item['domain_id']):
output[item['domain_id']]['relations'].append(item['range_id'])
else:
Expand All @@ -112,6 +114,20 @@ def get() -> tuple[Resource, int] | Response | dict[str, Any]:
'label': item['range_name'],
'systemClass': item['range_system_class'],
'relations': [item['domain_id']]}
if (item['property_code']
in ['P74', 'P7', 'P26', 'P27', 'OA8', 'OA9']):
location_ids.append(item['range_id'])

for link_ in links:
if (link_['property_code'] == 'P53'
and link_['range_id'] in location_ids):
output[link_['domain_id']] = {
'label': link_['domain_name'],
'systemClass': link_['domain_system_class'],
'relations':
output[link_['range_id']]['relations']
+ output[link_['domain_id']]['relations']}

results: dict[str, Any] = {'results': []}
for id_, dict_ in output.items():
if linked_to_id := parser.linked_to_ids:
Expand Down
Loading

0 comments on commit 4754567

Please sign in to comment.