Skip to content

Commit

Permalink
Fix #2118 - Wrong listing of type orphans
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Nov 13, 2023
1 parent 8afd4c4 commit 3f82b24
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions openatlas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def before_request() -> None:
g.properties = CidocProperty.get_all(session['language'])
g.classes = OpenatlasClass.get_all()
with_count = False
if request.path.startswith('/type') or \
request.path.startswith('/api/type_tree/') or (
if (request.path.startswith('/type')
or request.path.startswith('/api/type_tree/')
or request.path.startswith('/admin/orphans')
or (
request.path.startswith('/entity/') and
request.path.split('/entity/')[1].isdigit()):
request.path.split('/entity/')[1].isdigit())):
with_count = True
g.types = Type.get_all(with_count)
g.reference_systems = ReferenceSystem.get_all()
Expand Down
7 changes: 5 additions & 2 deletions openatlas/models/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,8 @@ def insert_hierarchy(
@staticmethod
def get_type_orphans() -> list[Type]:
return [
n for key, n in g.types.items()
if n.root and n.count < 1 and not n.subs]
node for key, node in g.types.items()
if node.root
and node.category not in ['system', 'tools']
and node.count < 1
and not node.subs]
2 changes: 1 addition & 1 deletion openatlas/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def admin_orphans() -> str:
table=Table(
['name', 'root'],
[[link(type_), link(g.types[type_.root[0]])]
for type_ in Type.get_type_orphans()])),
for type_ in Type.get_type_orphans()])),
'missing_files': Tab('missing_files', table=Table(header)),
'orphaned_files': Tab(
'orphaned_files',
Expand Down
5 changes: 3 additions & 2 deletions openatlas/views/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ def index_changelog() -> str:
versions = {
'7.17.3': ['2023-11-13', {
'fix': {
'2117': 'Modification events not showing at artifact view'}}],
'2117': 'Modification events not showing at artifact view',
'2118': 'Wrong listing of type orphans'}}],
'7.17.2': ['2023-11-09', {
'fix': {
'2114': 'JavaSrcipt datatable error'}}],
'2114': 'JavaScript datatable error'}}],
'7.17.1': ['2023-11-06', {
'fix': {
'2110': 'API: licensed file overview broken',
Expand Down

0 comments on commit 3f82b24

Please sign in to comment.