made voting threshold configurable
This commit is contained in:
parent
2789537cb4
commit
0aca96152f
3 changed files with 36 additions and 23 deletions
8
symposion/conf.py
Normal file
8
symposion/conf.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django.conf import settings
|
||||
|
||||
from appconf import AppConf
|
||||
|
||||
|
||||
class SymposionAppConf(AppConf):
|
||||
|
||||
VOTE_THRESHOLD = 3
|
|
@ -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)
|
||||
|
|
|
@ -15,23 +15,23 @@
|
|||
<div>
|
||||
{% if key == "positive" %}
|
||||
<h3>Positive
|
||||
<small>proposals with at least 3 votes and at least one +1 and no −1s</small></h3>
|
||||
<small>proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one +1 and no −1s</small></h3>
|
||||
{% endif %}
|
||||
{% if key == "negative" %}
|
||||
<h3>Negative
|
||||
<small>proposals with at least 3 votes and at least one −1 and no +1s</small></h3>
|
||||
<small>proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and at least one −1 and no +1s</small></h3>
|
||||
{% endif %}
|
||||
{% if key == "indifferent" %}
|
||||
<h3>Indifferent
|
||||
<small>proposals with at least 3 votes and neither a +1 or a −1</small></h3>
|
||||
<small>proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and neither a +1 or a −1</small></h3>
|
||||
{% endif %}
|
||||
{% if key == "controversial" %}
|
||||
<h3>Controversial
|
||||
<small>proposals with at least 3 votes and both a +1 and −1</small></h3>
|
||||
<small>proposals with at least {{ vote_threshold }} vote{{ vote_threshold|pluralize }} and both a +1 and −1</small></h3>
|
||||
{% endif %}
|
||||
{% if key == "too_few" %}
|
||||
<h3>Too Few Reviews
|
||||
<small>proposals with fewer than 3 votes</small></h3>
|
||||
<small>proposals with fewer than {{ vote_threshold }} vote{{ vote_threshold|pluralize }}</small></h3>
|
||||
{% endif %}
|
||||
|
||||
{% include "reviews/_review_table.html" %}
|
||||
|
@ -46,35 +46,35 @@
|
|||
<span class="badge">{{ proposals.positive.count }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
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
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="{% url review_status section_slug "negative" %}">Negative</a>
|
||||
<span class="badge">{{ proposals.negative.count }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
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
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="{% url review_status section_slug "indifferent" %}">Indifferent</a>
|
||||
<span class="badge">{{ proposals.indifferent.count }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
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
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="{% url review_status section_slug "controversial" %}">Controversial</a>
|
||||
<span class="badge">{{ proposals.controversial.count }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
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
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="{% url review_status section_slug "too_few" %}">Too Few Reviews</a>
|
||||
<span class="badge">{{ proposals.too_few.count }}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
proposals with fewer than 3 votes
|
||||
proposals with fewer than {{ vote_threshold }} vote{{ vote_threshold|pluralize }}
|
||||
</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue