Skip to content

Commit 95948b6

Browse files
committed
Be explicit about build order
1 parent 943935d commit 95948b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

readthedocs/projects/querysets.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def prefetch_latest_build(self):
8585

8686
# Prefetch the latest build for each project.
8787
subquery = Subquery(
88-
Build.objects.filter(project=OuterRef('project_id')).values_list('id', flat=True)[:1]
88+
Build.objects.filter(
89+
project=OuterRef('project_id')
90+
).order_by('-date').values_list('id', flat=True)[:1]
8991
)
9092
latest_build = Prefetch(
9193
'builds',

0 commit comments

Comments
 (0)