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

@ -304,10 +304,13 @@ def review_status(request, section_slug=None, key=None):
admin = request.user.has_perm("reviews.can_manage_%s" % section_slug) 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: if key:
ctx.update({ ctx.update({
"key": key, "key": key,
"proposals": proposals_generator(request, proposals[key], check_speaker=not admin), "proposals": proposals[key],
}) })
else: else:
ctx["proposals"] = proposals ctx["proposals"] = proposals

View file

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