diff --git a/src/openpecha/pecha/serializers/json.py b/src/openpecha/pecha/serializers/json.py index 570ea470..6ca7f3fb 100644 --- a/src/openpecha/pecha/serializers/json.py +++ b/src/openpecha/pecha/serializers/json.py @@ -306,7 +306,7 @@ def serialize_aligned_pechas_transformed_annotations(self): target_annotation_id, source_annotation_id = self.get_aligned_to_annotation_id(self.source_annotations) - is_target_annnotation_is_alignement = self._check_if_target_annotation_is_alignment_(self.target_annotations) + is_target_annnotation_is_alignement = self._check_if_target_annotation_is_alignment_(self.target_annotations, target_annotation_id) target_alignment_annotation = None if is_target_annnotation_is_alignement: @@ -350,8 +350,8 @@ def _get_target_segmentation_annotation_id_(self, target_annotations: list[dict] raise ValueError("No segmentation annotation found") - def _check_if_target_annotation_is_alignment_(self, target_annotations: list[dict]) -> bool: + def _check_if_target_annotation_is_alignment_(self, target_annotations: list[dict], target_annotation_id: str) -> bool: for target_annotation in target_annotations: - if (target_annotation['type'] == 'alignment'): + if (target_annotation['type'] == 'alignment' and target_annotation['id'] == target_annotation_id): return True return False \ No newline at end of file