From e1204c4ea25c317032d0450afa17aeac07c689cd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 4 Jun 2026 16:54:55 +0000 Subject: [PATCH 1/2] Builds: Add get_result_display property to Build model Centralizes the human-readable build result logic (passed/failed/ cancelled/building) so templates and other code can reuse it. https://claude.ai/code/session_012fjaaMr8qJHLJsqmJqE78e --- readthedocs/builds/models.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index d5387617cb7..48af82993c4 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -23,6 +23,7 @@ from readthedocs.builds.constants import BRANCH from readthedocs.builds.constants import BUILD_FINAL_STATES from readthedocs.builds.constants import BUILD_STATE +from readthedocs.builds.constants import BUILD_STATE_CANCELLED from readthedocs.builds.constants import BUILD_STATE_FINISHED from readthedocs.builds.constants import BUILD_STATE_TRIGGERED from readthedocs.builds.constants import BUILD_STATUS_CHOICES @@ -1064,6 +1065,17 @@ def get_commit_url(self): return None + @property + def get_result_display(self): + """Human-readable build result combining state and success.""" + if self.state == BUILD_STATE_FINISHED: + if self.success: + return _("Build passed") + return _("Build failed") + if self.state == BUILD_STATE_CANCELLED: + return _("Build cancelled") + return _("Building") + @property def finished(self): """Return if build has an end state.""" From 06858a05cff5b4d4763622117335be9359e95f4e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 4 Jun 2026 17:28:39 +0000 Subject: [PATCH 2/2] Change get_result_display from property to method Consistent with Django's get__display() convention. https://claude.ai/code/session_012fjaaMr8qJHLJsqmJqE78e --- readthedocs/builds/models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index 48af82993c4..799dda17828 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -1065,7 +1065,6 @@ def get_commit_url(self): return None - @property def get_result_display(self): """Human-readable build result combining state and success.""" if self.state == BUILD_STATE_FINISHED: