diff --git a/symposion/conf.py b/symposion/conf.py new file mode 100644 index 00000000..e2fb8072 --- /dev/null +++ b/symposion/conf.py @@ -0,0 +1,8 @@ +from django.conf import settings + +from appconf import AppConf + + +class SymposionAppConf(AppConf): + + VOTE_THRESHOLD = 3 diff --git a/symposion/reviews/views.py b/symposion/reviews/views.py index 545f2fd7..51192299 100644 --- a/symposion/reviews/views.py +++ b/symposion/reviews/views.py @@ -4,12 +4,14 @@ from django.views.decorators.http import require_POST from django.contrib.auth.decorators import login_required +from symposion.conf import settings from symposion.proposals.models import ProposalBase, ProposalSection +from symposion.teams.models import Team +from symposion.utils.mail import send_email + from symposion.reviews.forms import ReviewForm, SpeakerCommentForm from symposion.reviews.forms import BulkPresentationForm from symposion.reviews.models import ReviewAssignment, Review, LatestVote, ProposalResult -from symposion.teams.models import Team -from symposion.utils.mail import send_email def access_not_permitted(request): @@ -272,8 +274,11 @@ def review_delete(request, pk): @login_required def review_status(request, section_slug=None, key=None): + VOTE_THRESHOLD = settings.SYMPOSION_VOTE_THRESHOLD + ctx = { - "section_slug": section_slug + "section_slug": section_slug, + "vote_threshold": VOTE_THRESHOLD, } queryset = ProposalBase.objects.select_related("speaker__user", "result").select_subclasses() @@ -281,16 +286,16 @@ def review_status(request, section_slug=None, key=None): queryset = queryset.filter(kind__section__slug=section_slug) proposals = { - # proposals with at least 3 reviews and at least one +1 and no -1s, sorted by the 'score' - "positive": queryset.filter(result__vote_count__gte=3, result__plus_one__gt=0, result__minus_one=0).order_by("-result__score"), - # proposals with at least 3 reviews and at least one -1 and no +1s, reverse sorted by the 'score' - "negative": queryset.filter(result__vote_count__gte=3, result__minus_one__gt=0, result__plus_one=0).order_by("result__score"), - # proposals with at least 3 reviews and neither a +1 or a -1, sorted by total votes (lowest first) - "indifferent": queryset.filter(result__vote_count__gte=3, result__minus_one=0, result__plus_one=0).order_by("result__vote_count"), - # proposals with at least 3 reviews and both a +1 and -1, sorted by total votes (highest first) - "controversial": queryset.filter(result__vote_count__gte=3, result__plus_one__gt=0, result__minus_one__gt=0).order_by("-result__vote_count"), - # proposals with fewer than 3 reviews - "too_few": queryset.filter(result__vote_count__lt=3).order_by("result__vote_count"), + # proposals with at least VOTE_THRESHOLD reviews and at least one +1 and no -1s, sorted by the 'score' + "positive": queryset.filter(result__vote_count__gte=VOTE_THRESHOLD, result__plus_one__gt=0, result__minus_one=0).order_by("-result__score"), + # proposals with at least VOTE_THRESHOLD reviews and at least one -1 and no +1s, reverse sorted by the 'score' + "negative": queryset.filter(result__vote_count__gte=VOTE_THRESHOLD, result__minus_one__gt=0, result__plus_one=0).order_by("result__score"), + # proposals with at least VOTE_THRESHOLD reviews and neither a +1 or a -1, sorted by total votes (lowest first) + "indifferent": queryset.filter(result__vote_count__gte=VOTE_THRESHOLD, result__minus_one=0, result__plus_one=0).order_by("result__vote_count"), + # proposals with at least VOTE_THRESHOLD reviews and both a +1 and -1, sorted by total votes (highest first) + "controversial": queryset.filter(result__vote_count__gte=VOTE_THRESHOLD, 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) diff --git a/symposion/templates/reviews/review_stats.html b/symposion/templates/reviews/review_stats.html index cde67876..6451457f 100644 --- a/symposion/templates/reviews/review_stats.html +++ b/symposion/templates/reviews/review_stats.html @@ -15,23 +15,23 @@
{% if key == "positive" %}

Positive - proposals with at least 3 votes and at least one +1 and no −1s

+ proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one +1 and no −1s {% endif %} {% if key == "negative" %}

Negative - proposals with at least 3 votes and at least one −1 and no +1s

+ proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one −1 and no +1s {% endif %} {% if key == "indifferent" %}

Indifferent - proposals with at least 3 votes and neither a +1 or a −1

+ proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and neither a +1 or a −1 {% endif %} {% if key == "controversial" %}

Controversial - proposals with at least 3 votes and both a +1 and −1

+ proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and both a +1 and −1 {% endif %} {% if key == "too_few" %}

Too Few Reviews - proposals with fewer than 3 votes

+ proposals with fewer than {{ vote_threshold }} vote{{ vote_threshold|pluralize }} {% endif %} {% include "reviews/_review_table.html" %} @@ -46,35 +46,35 @@ {{ proposals.positive.count }}
- proposals with at least 3 votes and at least one +1 and no −1s + proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one +1 and no −1s
Negative {{ proposals.negative.count }}
- proposals with at least 3 votes and at least one −1 and no +1s + proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one −1 and no +1s
Indifferent {{ proposals.indifferent.count }}
- proposals with at least 3 votes and neither a +1 or a −1 + proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and neither a +1 or a −1
Controversial {{ proposals.controversial.count }}
- proposals with at least 3 votes and both a +1 and −1 + proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and both a +1 and −1
Too Few Reviews {{ proposals.too_few.count }}
- proposals with fewer than 3 votes + proposals with fewer than {{ vote_threshold }} vote{{ vote_threshold|pluralize }}
{% endif %}