Skip to content

Commit

Permalink
fix: prevent opentheso calls when indexing and concept_id is None
Browse files Browse the repository at this point in the history
  • Loading branch information
wiwski committed Nov 8, 2024
1 parent 638d7e9 commit 0c4d504
Show file tree
Hide file tree
Showing 2 changed files with 210 additions and 159 deletions.
10 changes: 6 additions & 4 deletions lab/elasticsearch/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _create_object_group_page_data(projects: list[Project], runs: list[Run]):
return page_data


# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments # noqa: C901
def build_project_catalog_document(
project: Project,
materials: list[str],
Expand Down Expand Up @@ -207,9 +207,11 @@ def build_object_group_catalog_document(
else fetch_period_parent_ids_from_id
)
if getattr(object_group, field_name):
theso_huma_num_parent_ids = fetch_parent_ids_fn(
getattr(object_group, field_name).concept_id
)
theso_huma_num_parent_ids = None
if getattr(getattr(object_group, field_name), "concept_id"):
theso_huma_num_parent_ids = fetch_parent_ids_fn(
getattr(object_group, field_name).concept_id
)
dating_dict = {
**dating_dict,
f"{field_name}_label": getattr( # type: ignore
Expand Down
Loading

0 comments on commit 0c4d504

Please sign in to comment.