Skip to content

Commit 5bc9e98

Browse files
committed
Added Comments & minor fix.
1 parent 02e8bac commit 5bc9e98

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

readthedocs/projects/views/private.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ def validate_primary_email(self, user):
9393
notification.send()
9494

9595
def get_queryset(self):
96+
# Filters the builds for a perticular project.
9697
builds = Build.objects.filter(
9798
project=OuterRef('pk'), type='html', state='finished')
99+
# Creates a Subquery object which returns
100+
# the value of Build.success of the latest build.
98101
sub_query = Subquery(builds.values('success')[:1])
99102
return Project.objects.dashboard(self.request.user).annotate(
100-
Count('builds'), build_success=sub_query)
103+
build_count=Count('builds'), latest_build_success=sub_query)
101104

102105
def get(self, request, *args, **kwargs):
103106
self.validate_primary_email(request.user)

readthedocs/templates/projects/project_dashboard_base.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h3>{% trans "Projects" %}</h3>
6666
{% block project-name %}
6767
{{ project.name }}
6868
{% endblock %}
69-
{% with builds=project.builds__count %}
69+
{% with builds=project.build_count %}
7070
{% if builds == 0 %}
7171
<span class="right quiet">
7272
{% trans "No builds yet" %}
@@ -80,7 +80,7 @@ <h3>{% trans "Projects" %}</h3>
8080
{{ builds }} builds
8181
{% endblocktrans %}
8282
</span>
83-
{% if project.build_success %}
83+
{% if project.latest_build_success %}
8484
<span class="build-state build-state-passing">{% trans "passing" %}</span>
8585
{% else %}
8686
<span class="build-state build-state-failing">{% trans "failing" %}</span>

0 commit comments

Comments
 (0)