[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 29 Aug 2005 18:36:04 -0000
albertel Mon Aug 29 14:36:04 2005 EDT
Modified files:
/loncom/homework/caparesponse caparesponse.pm
Log:
BUG#4300, when aparaenthetical sections where used the value of the match was being used to tell if the answer was correct, not if the regexp mathced
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.178 loncom/homework/caparesponse/caparesponse.pm:1.179
--- loncom/homework/caparesponse/caparesponse.pm:1.178 Wed Aug 17 12:37:11 2005
+++ loncom/homework/caparesponse/caparesponse.pm Mon Aug 29 14:36:03 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.178 2005/08/17 16:37:11 albertel Exp $
+# $Id: caparesponse.pm,v 1.179 2005/08/29 18:36:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -700,7 +700,7 @@
# $answer=$token->[2]->{'answer'};
# }
${$safeeval->varglob('LONCAPA::response')}=$response;
- $result = &Apache::run::run('return $LONCAPA::response=~m'.$answer,$safeeval);
+ $result = &Apache::run::run('if ($LONCAPA::response=~m'.$answer.') { return 1; } else { return 0; }',$safeeval);
&Apache::lonxml::debug("current $response");
&Apache::lonxml::debug("current $answer");
$ad = ($result) ? 'APPROX_ANS' : 'INCORRECT';