Skip to content

Commit 5eeccc6

Browse files
committed
refactor: improve first_boost_version query
1 parent 8d51fdd commit 5eeccc6

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

libraries/models.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,12 @@ def github_properties(self):
446446
@cached_property
447447
def first_boost_version(self):
448448
"""Returns the first Boost version that included this library"""
449-
if not self.library_version.exists():
450-
return
451-
return (
452-
self.library_version.order_by("version__release_date", "version__name")
449+
first = (
450+
self.library_version.select_related("version")
451+
.order_by("version__release_date", "version__name")
453452
.first()
454-
.version
455453
)
454+
return first.version if first else None
456455

457456
@cached_property
458457
def github_owner(self):

0 commit comments

Comments
 (0)