From fd756b9f858f2952c4aa054b59036ce00b5dcefb Mon Sep 17 00:00:00 2001 From: Julian Arni Date: Mon, 1 Jul 2013 18:00:34 -0400 Subject: [PATCH] Only refresh when waitfor is an attribute. Silly workaround for the fact that tests set the answers, but not the inputs, so refreshAnswers changes the test result even though it shouldn't. --- common/lib/xmodule/xmodule/js/src/capa/display.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index b914db9c55..df24abcc00 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -136,7 +136,7 @@ class @Problem # invalid. To do so, the callee must throw an exception named "Waitfor # Exception". This and any other errors or exceptions that arise from the # callee are rethrown and abort the submission. - # + # # In order to use this feature, add a 'data-waitfor' attribute to the input, # and specify the function to be called by the check button before sending # off @answers @@ -145,13 +145,13 @@ class @Problem if ($(inp).is("input[waitfor]")) try $(inp).data("waitfor")() + @refreshAnswers() catch e if e.name == "Waitfor Exception" alert e.message else alert "Could not grade your answer. The submission was aborted." throw e - @refreshAnswers() ### @@ -164,7 +164,6 @@ class @Problem check_fd: => Logger.log 'problem_check', @answers - # If there are no file inputs in the problem, we can fall back on @check if $('input:file').length == 0 @check()