diff --git a/judge/models/problem.py b/judge/models/problem.py index 43b529c6b3..626d1212d9 100644 --- a/judge/models/problem.py +++ b/judge/models/problem.py @@ -443,29 +443,22 @@ def save(self, *args, **kwargs): save.alters_data = True def can_vote(self, user): - print('user') - print('\tauthed', user.is_authenticated) if not user.is_authenticated: return False # If the user is in contest, nothing should be shown. - print('\tcontest', user.profile.current_contest) if user.profile.current_contest: return False # If the user is not allowed to vote - print('\tunlisted', user.profile.is_unlisted) - print('\tbanned from voting', user.profile.is_banned_problem_voting) if user.profile.is_unlisted or user.profile.is_banned_problem_voting: return False # If the user is banned from submitting to the problem. - print('\tbanned from problem', self.banned_users.filter(pk=user.pk), self.banned_users.filter(pk=user.pk).exists()) if self.banned_users.filter(pk=user.pk).exists(): return False # If the user has a full AC submission to the problem (solved the problem). - print('\tac problem',self.submission_set.filter(user=user.profile, result='AC', points=F('problem__points')), self.submission_set.filter(user=user.profile, result='AC', points=F('problem__points')).exists()) return self.submission_set.filter(user=user.profile, result='AC', points=F('problem__points')).exists() class Meta: diff --git a/templates/problem/voting-controls.html b/templates/problem/voting-controls.html index 7869deda19..0243713a0e 100644 --- a/templates/problem/voting-controls.html +++ b/templates/problem/voting-controls.html @@ -144,7 +144,7 @@ if (has_voted) voteUpdate(); else deleteVoteUpdate(); - $('#id_vote_form').on('submit', e => e.preventDefault()); + $('#id_delete_vote_form').on('submit', e => e.preventDefault()); $('#id_delete_vote_form_submit_button').on('click', e => { e.preventDefault(); $.ajax({ @@ -168,15 +168,13 @@ $('#id_vote_form').on('submit', e => e.preventDefault()); $('#id_vote_form_submit_button').on('click', e => { - e.preventDefault() - console.log('sending'); + e.preventDefault(); $.ajax({ url: '{{ url('vote', object.code) }}', type: 'POST', data: $('#id_vote_form').serialize(), success: data => { - console.log('worked'); - updateUserVote(voted_points, data.points) + updateUserVote(voted_points, data.points); voted_note = data.note; voted_points = data.points; voteUpdate(); @@ -185,8 +183,6 @@ closeLightbox('id_voting_lightbox'); }, error: data => { - console.log('didnt work'); - console.log(data); let errors = data.responseJSON; if('points' in errors){ $('#id_points_error_box').show();