Skip to content

Commit 2ba8fb2

Browse files
committed
Re-add code deleted by mistake
The only part that had to be removed originally was the ".exclude()".
1 parent 179a2b0 commit 2ba8fb2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

readthedocs/projects/views/public.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from readthedocs.analytics.tasks import analytics_event
2424
from readthedocs.analytics.utils import get_client_ip
25-
from readthedocs.builds.constants import LATEST
25+
from readthedocs.builds.constants import BUILD_STATE_FINISHED, LATEST
2626
from readthedocs.builds.models import Version
2727
from readthedocs.builds.views import BuildTriggerMixin
2828
from readthedocs.core.permissions import AdminPermission
@@ -184,6 +184,18 @@ def get(self, request, project_slug, *args, **kwargs):
184184
slug=version_slug,
185185
).first()
186186

187+
if version:
188+
last_build = (
189+
version.builds.filter(type="html", state=BUILD_STATE_FINISHED)
190+
.order_by("-date")
191+
.first()
192+
)
193+
if last_build:
194+
if last_build.success:
195+
status = self.STATUS_PASSING
196+
else:
197+
status = self.STATUS_FAILING
198+
187199
return self.serve_badge(request, status)
188200

189201
def get_style(self, request):

0 commit comments

Comments
 (0)