Skip to content

Commit

Permalink
Looking into type performance with Bernhard
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Oct 23, 2023
1 parent 20e0731 commit 085e796
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions openatlas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ def before_request() -> None:
g.cidoc_classes = CidocClass.get_all(session['language'])
g.properties = CidocProperty.get_all(session['language'])
g.classes = OpenatlasClass.get_all()

from time import perf_counter
start_time = perf_counter()

g.types = Type.get_all()

end_time = perf_counter()
elapsed_time = end_time - start_time
print(f"Elapsed time: {elapsed_time} seconds")

g.reference_systems = ReferenceSystem.get_all()
g.view_class_mapping = view_class_mapping
g.class_view_mapping = OpenatlasClass.get_class_view_mapping()
Expand Down
2 changes: 1 addition & 1 deletion openatlas/models/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def move_entities(self, new_type_id: int, checkbox_values: str) -> None:
Db.remove_entity_type(self.id, delete_ids)

@staticmethod
def get_all() -> dict[int, Type]:
def get_all(with_count: bool = False) -> dict[int, Type]:
types = {}
for row in \
Db.get_types('type', 'P127') + \
Expand Down

0 comments on commit 085e796

Please sign in to comment.