Fixed bug when user votes w/o permission - now displays a friendly error message instead of failing.

Fixed bug when hinter module displays a hint, then is asked to display nothing.  (Used to not update in this case.)
This commit is contained in:
Felix Sun
2013-07-02 09:40:47 -04:00
committed by Carlos Andrés Rocha
parent 15317de252
commit 560cd9b068
3 changed files with 15 additions and 8 deletions

View File

@@ -227,7 +227,7 @@ class CrowdsourceHinterModule(CrowdsourceHinterFields, XModule):
Returns key 'hint_and_votes', a list of (hint_text, #votes) pairs.
"""
if self.user_voted:
return json.dumps({'contents': 'Sorry, but you have already voted!'})
return {}
ans_no = int(get['answer'])
hint_no = str(get['hint'])
answer = self.previous_answers[ans_no][0]

View File

@@ -72,3 +72,5 @@ class @Hinter
JavascriptLoader.executeModuleScripts @el, () =>
@bind()
@$('#previous-answer-0').css('display', 'inline')
else
@el.hide()