diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index cbcd13b02b..a1a4e6b65e 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -633,9 +633,11 @@ class MultipleChoiceResponse(LoncapaResponse): # define correct choices (after calling secondary setup) xml = self.xml cxml = xml.xpath('//*[@id=$id]//choice', id=xml.get('id')) + # contextualize correct attribute and then select ones for which # correct = "true" - self.correct_choices = [contextualize_text(choice.get('name'), self.context) + self.correct_choices = [ + contextualize_text(choice.get('name'), self.context) for choice in cxml if contextualize_text(choice.get('correct'), self.context) == "true"] diff --git a/common/lib/capa/capa/templates/designprotein2dinput.html b/common/lib/capa/capa/templates/designprotein2dinput.html index ff845f8713..6733566ab9 100644 --- a/common/lib/capa/capa/templates/designprotein2dinput.html +++ b/common/lib/capa/capa/templates/designprotein2dinput.html @@ -1,5 +1,5 @@
-
+
% if status == 'unsubmitted': diff --git a/common/static/js/capa/design-protein-2d.js b/common/static/js/capa/design-protein-2d.js index c0db798e2c..e068fa8dcf 100644 --- a/common/static/js/capa/design-protein-2d.js +++ b/common/static/js/capa/design-protein-2d.js @@ -22,6 +22,15 @@ // It calls protexIsReady with a deferred command when it has finished // initialization and has drawn itself + function updateProtexField() { + var problem = $('#protex_container').parents('.problem'); + var input_field = problem.find('input[type=hidden]'); + var protex_answer = protexCheckAnswer(); + var value = {protex_answer: protex_answer}; + //console.log(JSON.stringify(value)); + input_field.val(JSON.stringify(value)); + } + protexIsReady = function() { //Load target shape var target_shape = $('#target_shape').val(); @@ -29,15 +38,18 @@ //Get answer from protex and store it into the hidden input field //when Check button is clicked - var problem = $('#protex_container').parents('.problem'); - var check_button = problem.find('input.check'); - var input_field = problem.find('input[type=hidden]'); - check_button.on('click', function() { + var fold_button = $("#fold-button"); + fold_button.on('click', function(){ + var problem = $('#protex_container').parents('.problem'); + var input_field = problem.find('input[type=hidden]'); var protex_answer = protexCheckAnswer(); var value = {protex_answer: protex_answer}; + //console.log(JSON.stringify(value)); input_field.val(JSON.stringify(value)); - }); + }); + updateProtexField(); }; + /*function initializeProtex() { //Check to see if the two exported GWT functions protexSetTargetShape