use generator to ensure proposals are filtered by speaker

This commit is contained in:
Luke Hatcher 2012-08-25 19:54:17 -04:00
parent d427ef2941
commit 6ee3ff5d45
2 changed files with 10 additions and 7 deletions

View file

@ -301,13 +301,16 @@ def review_status(request, section_slug=None, key=None):
# proposals with fewer than VOTE_THRESHOLD reviews
"too_few": queryset.filter(result__vote_count__lt=VOTE_THRESHOLD).order_by("result__vote_count"),
}
admin = request.user.has_perm("reviews.can_manage_%s" % section_slug)
for status in proposals:
proposals[status] = list(proposals_generator(request, proposals[status], check_speaker=not admin))
if key:
ctx.update({
"key": key,
"proposals": proposals_generator(request, proposals[key], check_speaker=not admin),
"proposals": proposals[key],
})
else:
ctx["proposals"] = proposals

View file

@ -43,35 +43,35 @@
<dl>
<dt>
<a href="{% url review_status section_slug "positive" %}">Positive</a>
<span class="badge">{{ proposals.positive.count }}</span>
<span class="badge">{{ proposals.positive|length }}</span>
</dt>
<dd>
proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one +1 and no &minus;1s
</dd>
<dt>
<a href="{% url review_status section_slug "negative" %}">Negative</a>
<span class="badge">{{ proposals.negative.count }}</span>
<span class="badge">{{ proposals.negative|length }}</span>
</dt>
<dd>
proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one &minus;1 and no +1s
</dd>
<dt>
<a href="{% url review_status section_slug "indifferent" %}">Indifferent</a>
<span class="badge">{{ proposals.indifferent.count }}</span>
<span class="badge">{{ proposals.indifferent|length }}</span>
</dt>
<dd>
proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and neither a +1 or a &minus;1
</dd>
<dt>
<a href="{% url review_status section_slug "controversial" %}">Controversial</a>
<span class="badge">{{ proposals.controversial.count }}</span>
<span class="badge">{{ proposals.controversial|length }}</span>
</dt>
<dd>
proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and both a +1 and &minus;1
</dd>
<dt>
<a href="{% url review_status section_slug "too_few" %}">Too Few Reviews</a>
<span class="badge">{{ proposals.too_few.count }}</span>
<span class="badge">{{ proposals.too_few|length }}</span>
</dt>
<dd>
proposals with fewer than {{ vote_threshold }} vote{{ vote_threshold|pluralize }}