diff --git a/common/lib/xmodule/xmodule/crowdsource_hinter.py b/common/lib/xmodule/xmodule/crowdsource_hinter.py index f84b366d2c..5b9c0a1899 100644 --- a/common/lib/xmodule/xmodule/crowdsource_hinter.py +++ b/common/lib/xmodule/xmodule/crowdsource_hinter.py @@ -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] diff --git a/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee b/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee index f8bc6037db..72522f5b03 100644 --- a/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/crowdsource_hinter/display.coffee @@ -72,3 +72,5 @@ class @Hinter JavascriptLoader.executeModuleScripts @el, () => @bind() @$('#previous-answer-0').css('display', 'inline') + else + @el.hide() diff --git a/common/templates/hinter_display.html b/common/templates/hinter_display.html index bc49bf18bd..6f5d6f37fb 100644 --- a/common/templates/hinter_display.html +++ b/common/templates/hinter_display.html @@ -95,13 +95,17 @@ What would you say to help someone who got this wrong answer? <%def name="show_votes()"> - Thank you for voting! -
- % for hint, votes in hint_and_votes: - ${votes} votes. - ${hint} -
- % endfor + % if hint_and_votes is UNDEFINED: + Sorry, but you've already voted! + % else: + Thank you for voting! +
+ % for hint, votes in hint_and_votes: + ${votes} votes. + ${hint} +
+ % endfor + % endif <%def name="simple_message()"> @@ -123,3 +127,4 @@ What would you say to help someone who got this wrong answer? % if op == "vote": ${show_votes()} % endif +