From b484f903ca05496eba381db0135250ed1623ddc0 Mon Sep 17 00:00:00 2001 From: Brianna Cerkiewicz Date: Thu, 14 Nov 2024 14:54:26 -0800 Subject: [PATCH] chore: fix filtering for N/A --- bc_obps/registration/schema/v1/transfer_event.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bc_obps/registration/schema/v1/transfer_event.py b/bc_obps/registration/schema/v1/transfer_event.py index d0f494859e..52ca201fe4 100644 --- a/bc_obps/registration/schema/v1/transfer_event.py +++ b/bc_obps/registration/schema/v1/transfer_event.py @@ -6,6 +6,7 @@ from ninja import ModelSchema, Field, FilterSchema from django.db.models import Q import re +from typing import Dict, Any class FacilityForTransferEventGrid(ModelSchema): @@ -22,9 +23,9 @@ class TransferEventListOut(ModelSchema): id: UUID @staticmethod - def resolve_id(obj: TransferEvent) -> UUID: - operation_id = getattr(obj, 'operation__id', None) - facility_id = getattr(obj, 'facilities__id', None) + def resolve_id(obj: Dict[str, Any]) -> UUID: + operation_id = obj.get('operation__id', None) + facility_id = obj.get('facilities__id', None) record_id = operation_id if operation_id else facility_id if not isinstance(record_id, UUID):