From 750cac59ce1fa26e405cdcab85ff33ae3b39daaa Mon Sep 17 00:00:00 2001 From: Nick Jackson Date: Thu, 19 Dec 2024 21:17:35 +0000 Subject: [PATCH] fix(Identifiers): preferred identifier now correctly handles case where there are none of type --- src/caselawclient/models/identifiers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/caselawclient/models/identifiers/__init__.py b/src/caselawclient/models/identifiers/__init__.py index a87a3669..da40e341 100644 --- a/src/caselawclient/models/identifiers/__init__.py +++ b/src/caselawclient/models/identifiers/__init__.py @@ -177,6 +177,6 @@ def preferred(self, type: Optional[type[Identifier]] = None) -> Optional[Identif :return: Return the highest scoring identifier of the given type (or of any type, if none is specified). Returns `None` if no identifier is available. """ - if len(self) == 0: + if len(self.by_score(type)) == 0: return None return self.by_score(type)[0]