Skip to content

Commit

Permalink
chore: fix filtering for N/A
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed Nov 14, 2024
1 parent 26f01de commit 4fe3a3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bc_obps/registration/schema/v1/transfer_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 4fe3a3a

Please sign in to comment.