diff --git a/colleges/templates/colleges/_potentialfellowship_voting_table.html b/colleges/templates/colleges/_potentialfellowship_voting_table.html index c0361456b5d40413b3777cb42316d929d799c778..84e009e541bdbda48ed66ebc7ee7a48059c5cb83 100644 --- a/colleges/templates/colleges/_potentialfellowship_voting_table.html +++ b/colleges/templates/colleges/_potentialfellowship_voting_table.html @@ -17,15 +17,15 @@ Click to vote: <form action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='A' %}" method="post"> {% 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 action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='N' %}" method="post"> {% 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 action="{% url 'colleges:vote_on_potential_fellowship' potfel_id=potfel.id vote='D' %}" method="post"> {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ potfel.nr_D }}"/> + <input type="submit" class="disagree" value="Disagree {{ potfel.in_disagreement.count }}"/> </form> {% if request.user.contributor in potfel.in_agreement.all %} <strong>(you have voted: Agreed)</strong> diff --git a/colleges/views.py b/colleges/views.py index 10b0070361a8917515cb6e7d5663a487ecec7b41..e5cf6c49720c23b42b7fc6e88b7d08e4eda9d6b4 100644 --- a/colleges/views.py +++ b/colleges/views.py @@ -380,11 +380,9 @@ class PotentialFellowshipListView(PermissionsMixin, PaginationMixin, ListView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['potfels_to_vote_on'] = PotentialFellowship.objects.to_vote_on( - self.request.user.contributor).annotate( - nr_A=Count('in_agreement'), nr_N=Count('in_abstain'), nr_D=Count('in_disagreement')) + self.request.user.contributor) context['potfels_voted_on'] = PotentialFellowship.objects.voted_on( - self.request.user.contributor).annotate( - nr_A=Count('in_agreement'), nr_N=Count('in_abstain'), nr_D=Count('in_disagreement')) + self.request.user.contributor) context['subject_areas'] = SCIPOST_SUBJECT_AREAS context['statuses'] = POTENTIAL_FELLOWSHIP_STATUSES return context