Skip to content

Commit

Permalink
Merge 981d33e into 9e406cc
Browse files Browse the repository at this point in the history
  • Loading branch information
ananyo2012 committed Jul 6, 2018
2 parents 9e406cc + 981d33e commit ef2b942
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ install:
- pip install pip==9.0.1
- pip install -r requirements-dev.txt --allow-all-external
- pip install coveralls
- pip install --upgrade pytest

env:
- DJANGO_SETTINGS_MODULE="settings.test_settings"
Expand Down
8 changes: 5 additions & 3 deletions junction/proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def _get_proposal_section_reviewer_vote_choices(conference):
for i in ProposalSectionReviewerVoteValue.objects.all():
if i.vote_value == 0 and not plus_zero_vote_setting_value:
continue
values.append((i.vote_value, '{} ({})'.format(
i.description, i.vote_value)))
values.append((i.vote_value, '{}'.format(i.description)))
return values


Expand Down Expand Up @@ -155,7 +154,10 @@ class ProposalReviewerVoteForm(forms.Form):
"""
Used by ProposalSectionReviewers to vote on proposals.
"""
vote_value = forms.ChoiceField(widget=forms.RadioSelect())
vote_value = forms.ChoiceField(
widget=forms.RadioSelect(),
label="Do you think this proposal will make a good addition to PyCon India 2018?"
)
comment = forms.CharField(
widget=forms.Textarea(attrs={'minlength': '30'}),
help_text="Leave a comment justifying your vote.",
Expand Down
16 changes: 12 additions & 4 deletions junction/proposals/templatetags/proposal_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from junction.base.constants import PSRVotePhase
from junction.proposals.models import ProposalComment, ProposalSectionReviewer, \
ProposalSectionReviewerVote

from junction.proposals.permissions import is_proposal_section_reviewer

register = template.Library()

Expand Down Expand Up @@ -53,21 +53,29 @@ def has_upvoted_comment(comment, user):
return vote[0].up_vote


@register.filter(name='proposal_section_reviewer')
def proposal_section_reviewer(proposal, user):
"""
Checks if the logged in user is a section reviewer
"""
return is_proposal_section_reviewer(user, proposal.conference, proposal)


@register.filter(name='get_reviewers_vote_details')
def get_reviewers_vote_details(proposal, user):
"""
Get voter name & details for given proposals.
"""
v_detail = collections.namedtuple('v_detail',
'voter vote_value vote_comment')
'voter_nick vote_value vote_comment')
reviewers = ProposalSectionReviewer.objects.filter(
proposal_section=proposal.proposal_section,
conference_reviewer__conference=proposal.conference,
)

vote_details = []
for reviewer in reviewers:
voter = reviewer.conference_reviewer.reviewer.get_full_name()
voter_nick = reviewer.conference_reviewer.nick
rv_qs = ProposalSectionReviewerVote.objects.filter(
proposal=proposal,
voter=reviewer)
Expand All @@ -85,6 +93,6 @@ def get_reviewers_vote_details(proposal, user):
else:
vote_comment = None

vote_details.append(v_detail(voter, vote_value, vote_comment))
vote_details.append(v_detail(voter_nick, vote_value, vote_comment))

return vote_details
2 changes: 1 addition & 1 deletion junction/static/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ input[type="search"] {
.radio,
.checkbox {
position: relative;
display: block;
display: inline;
margin-top: 10px;
margin-bottom: 10px;
}
Expand Down
2 changes: 1 addition & 1 deletion junction/templates/proposals/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<a class='btn btn-primary' href="{% url 'proposals-to-review' conference.slug %}">Proposals To Review</a>
<a class='btn btn-primary' href="{% url 'second-phase-voting' conference.slug %}">Second Phase Voting</a>
{% endif %}
{% if user.is_superuser or user.is_stuff %}
{% if user.is_superuser or user.is_staff %}
<a class='btn btn-primary' href="{% url 'proposal-reviewer-votes-dashboard' conference.slug %}">
Reviewer Votes Dashboard
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ <h3 class="proposal--title">
Sum of Votes: {{ proposal.get_reviewer_votes_sum }}
{% for vote in proposal|get_reviewers_vote_details:request.user %}
<li>
{{ vote.voter }}:
{{ vote.vote_value }}
{{ vote.voter_nick }}:
<!-- {{ vote.vote_value }} -->
{% if vote.vote_comment %}
, "{{ vote.vote_comment }}"
"{{ vote.vote_comment }}"
{% endif %}

</li>
{% endfor %}
<br />
<a class='btn btn-primary' href="{% url 'proposal-review' conference.slug proposal.slug %}">
Accept/Reject Proposal
</a>
<!-- {% if proposal|proposal_section_reviewer:request.user %}
<a class='btn btn-primary' href="{% url 'proposal-review' conference.slug proposal.slug %}">
Accept/Reject Proposal
</a>
{% endif %} -->
</div>


Expand Down

0 comments on commit ef2b942

Please sign in to comment.