@@ -60,25 +60,25 @@ def proposals_generator(request, queryset, user_pk=None, check_speaker=True):
yield obj
# Returns a list of all proposals, proposals reviewed by the user, or the proposals the user has
# yet to review depending on the link user clicks in dashboard
@login_required
def review_section(request, section_slug, assigned=False, reviewed="all"):
if not request.user.has_perm("reviews.can_review_%s" % section_slug):
return access_not_permitted(request)
section = get_object_or_404(ProposalSection, section__slug=section_slug)
queryset = ProposalBase.objects.filter(kind__section=section)
queryset = ProposalBase.objects.filter(kind__section=section.section)
if assigned:
assignments = ReviewAssignment.objects.filter(user=request.user)\
.values_list("proposal__id")
queryset = queryset.filter(id__in=assignments)
# passing reviewed in from reviews.urls and out to review_list for
# appropriate template header rendering
if reviewed == "all":
queryset = queryset.select_related("result").select_subclasses()
reviewed = "all_reviews"
elif reviewed == "reviewed":
@@ -334,26 +334,25 @@ def review_status(request, section_slug=None, key=None):
result__plus_one__gt=0, result__minus_one__gt=0)
.order_by("-result__vote_count"),
# 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:
if key and key != status:
continue
proposals[status] = list(proposals_generator(request, proposals[status],
check_speaker=not admin))
proposals[status] = list(proposals_generator(request, proposals[status], check_speaker=not admin))
if key:
ctx.update({
"key": key,
"proposals": proposals[key],
})
else:
ctx["proposals"] = proposals
return render(request, "reviews/review_stats.html", ctx)
@@ -400,27 +399,25 @@ def review_bulk_accept(request, section_slug):
form = BulkPresentationForm()
return render(request, "reviews/review_bulk_accept.html", {
"form": form,
def result_notification(request, section_slug, status):
if not request.user.has_perm("reviews.can_manage_%s" % section_slug):
proposals = ProposalBase.objects.filter(kind__section__slug=section_slug,
result__status=status)\
.select_related("speaker__user", "result").select_subclasses()
proposals = ProposalBase.objects.filter(kind__section__slug=section_slug, result__status=status).select_related("speaker__user", "result").select_subclasses()
notification_templates = NotificationTemplate.objects.all()
ctx = {
"section_slug": section_slug,
"status": status,
"proposals": proposals,
"notification_templates": notification_templates,
return render(request, "reviews/result_notification.html", ctx)