[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm
riegler
riegler@source.lon-capa.org
Fri, 06 Feb 2009 10:43:48 -0000
riegler Fri Feb 6 10:43:48 2009 EDT
Modified files:
/loncom/homework default_homework.lcpm
Log:
There are problems coded as formula resonse WITHOUT sampling requiring the student to enter a set (such as {4,2,b,z}).
As of version 1.142 sets as student's input would return BAD_FORMULA, because they contain commas.
With this version BAD_FORMULA will only be returned if the response contains a , but not a set.
These set problems are inpossible to code using mathresponse as it splits the response at commas. Hence RESPONSE[1]='{4' for the above set which is not a legel maxima expression.
These set problems could be coded by customresponse in combination mathresponse. customresponse would be used to remove the curly brackets. This way of coding, however, is very ackward as compared to formula response.
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.142 loncom/homework/default_homework.lcpm:1.143
--- loncom/homework/default_homework.lcpm:1.142 Wed Nov 26 18:11:52 2008
+++ loncom/homework/default_homework.lcpm Fri Feb 6 10:43:48 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
#
-# $Id: default_homework.lcpm,v 1.142 2008/11/26 18:11:52 raeburn Exp $
+# $Id: default_homework.lcpm,v 1.143 2009/02/06 10:43:48 riegler Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -220,7 +220,7 @@
if (($type eq '9') || ($type eq '8')) {
if ($response=~/\=/) {
return ('BAD_FORMULA','Please submit just an expression, not an equation.');
- } elsif ($response =~ /\,/) {
+ } elsif ($response =~ /\,/ and $response !~ /^\s*\{.*\}\s*$/) {
return ('BAD_FORMULA');
}
}