Commit 0b99e802 by Matjaz Gregoric

Merge pull request #9 from mckinseyacademy/cleanup

Addressed remaining issues from second review
parents 1a94e3ef 99f7667a
...@@ -385,6 +385,7 @@ class PollBlock(PollBase): ...@@ -385,6 +385,7 @@ class PollBlock(PollBase):
if not self.can_vote(): if not self.can_vote():
result['errors'].append('You have already voted as many times as you are allowed.') result['errors'].append('You have already voted as many times as you are allowed.')
return result
self.clean_tally() self.clean_tally()
if old_choice is not None: if old_choice is not None:
......
...@@ -16,7 +16,9 @@ function PollUtil (runtime, element, pollType) { ...@@ -16,7 +16,9 @@ function PollUtil (runtime, element, pollType) {
self.getResults({'success': true}); self.getResults({'success': true});
return false; return false;
} }
if (parseInt($('.poll-max-submissions').text()) > 1 && parseInt($('.poll-current-count').text()) > 0) { var max_submissions = parseInt($('.poll-max-submissions', element).text());
var current_count = parseInt($('.poll-current-count', element).text());
if (max_submissions > 1 && current_count > 0) {
$('.poll-submissions-count', element).show(); $('.poll-submissions-count', element).show();
} }
return true; return true;
...@@ -117,7 +119,7 @@ function PollUtil (runtime, element, pollType) { ...@@ -117,7 +119,7 @@ function PollUtil (runtime, element, pollType) {
var can_vote = data['can_vote']; var can_vote = data['can_vote'];
$('.poll-current-count', element).text(data['submissions_count']); $('.poll-current-count', element).text(data['submissions_count']);
if (data['max_submissions'] > 1) { if (data['max_submissions'] > 1) {
$('.poll-submissions-count').show(); $('.poll-submissions-count', element).show();
} }
if ($('div.poll-block', element).data('private')) { if ($('div.poll-block', element).data('private')) {
// User may be changing their vote. Give visual feedback that it was accepted. // User may be changing their vote. Give visual feedback that it was accepted.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment