SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit ca532d91 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix counting query going wrong

parent c582be86
No related branches found
No related tags found
No related merge requests found
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
Click to vote: Click to vote:
<form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='A' %}" method="post"> <form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='A' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="agree" value="Agree {{ potfel.nr_A }} "/> <input type="submit" class="agree" value="Agree {{ potfel.in_agreement.count }} "/>
</form> </form>
<form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='N' %}" method="post"> <form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='N' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="notsure" value="Abstain {{ potfel.nr_N }}"/> <input type="submit" class="notsure" value="Abstain {{ potfel.in_abstain.count }}"/>
</form> </form>
<form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='D' %}" method="post"> <form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='D' %}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="disagree" value="Disagree {{ potfel.nr_D }}"/> <input type="submit" class="disagree" value="Disagree {{ potfel.in_disagreement.count }}"/>
</form> </form>
{% if request.user.contributor in potfel.in_agreement.all %} {% if request.user.contributor in potfel.in_agreement.all %}
<strong>(you have voted: Agreed)</strong> <strong>(you have voted: Agreed)</strong>
......
...@@ -380,11 +380,9 @@ class PotentialFellowshipListView(PermissionsMixin, PaginationMixin, ListView): ...@@ -380,11 +380,9 @@ class PotentialFellowshipListView(PermissionsMixin, PaginationMixin, ListView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['potfels_to_vote_on'] = PotentialFellowship.objects.to_vote_on( context['potfels_to_vote_on'] = PotentialFellowship.objects.to_vote_on(
self.request.user.contributor).annotate( self.request.user.contributor)
nr_A=Count('in_agreement'), nr_N=Count('in_abstain'), nr_D=Count('in_disagreement'))
context['potfels_voted_on'] = PotentialFellowship.objects.voted_on( context['potfels_voted_on'] = PotentialFellowship.objects.voted_on(
self.request.user.contributor).annotate( self.request.user.contributor)
nr_A=Count('in_agreement'), nr_N=Count('in_abstain'), nr_D=Count('in_disagreement'))
context['subject_areas'] = SCIPOST_SUBJECT_AREAS context['subject_areas'] = SCIPOST_SUBJECT_AREAS
context['statuses'] = POTENTIAL_FELLOWSHIP_STATUSES context['statuses'] = POTENTIAL_FELLOWSHIP_STATUSES
return context return context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment