[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm hint.pm /homework/caparesponse caparesponse.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 13 Sep 2008 02:08:35 -0000
raeburn Fri Sep 12 22:08:35 2008 EDT
Modified files:
/loncom/homework hint.pm default_homework.lcpm
/loncom/homework/caparesponse caparesponse.pm
Log:
- Bug 5793
Alternative solution. Revert default_homework.lcpm to 1.138. No longer need to pass tag arg to caparesponse_check_list().
- Instead set $$args_ref{'type'} to 'ci' (the default) if type attrib is missing or null in the corresponding <stringhint> (hint.pm), or <stringresponse> (caparesponse.pm) tags.
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.70 loncom/homework/hint.pm:1.71
--- loncom/homework/hint.pm:1.70 Fri Sep 12 05:56:09 2008
+++ loncom/homework/hint.pm Fri Sep 12 22:08:32 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# implements the tags that control the hints
#
-# $Id: hint.pm,v 1.70 2008/09/12 09:56:09 raeburn Exp $
+# $Id: hint.pm,v 1.71 2008/09/13 02:08:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -194,7 +194,7 @@
dclone($answer{$ans_name});
&Apache::caparesponse::setup_capa_response($args_ref,$response);
my ($result,@msgs) =
- &Apache::run::run("&caparesponse_check_list($$tagstack[-1])",$safeeval);
+ &Apache::run::run("&caparesponse_check_list()",$safeeval);
&Apache::lonxml::debug("checking $ans_name $result with $response");
&Apache::lonxml::debug('msgs are '.join(':',@msgs));
my ($awards)=split(/:/,$result);
@@ -422,13 +422,16 @@
my $args_ref =
&Apache::caparesponse::setup_capa_args($safeeval,$parstack,
\@args,$response);
+ if ($$args_ref{'type'} eq '') {
+ $$args_ref{'type'} = 'ci';
+ }
&Apache::caparesponse::add_in_tag_answer($parstack,$safeeval);
my (@final_awards,@final_msgs,@ans_names);
my %answer = &Apache::caparesponse::get_answer();
foreach my $ans_name (keys(%answer)) {
&Apache::lonxml::debug(" doing $ans_name with ".join(':',@{ $answer{$ans_name}{'answers'} }));
${$safeeval->varglob('LONCAPA::CAPAresponse_answer')}=dclone($answer{$ans_name});
- my ($result, @msgs)=&Apache::run::run("&caparesponse_check_list($$tagstack[-1])",$safeeval);
+ my ($result, @msgs)=&Apache::run::run("&caparesponse_check_list()",$safeeval);
&Apache::lonxml::debug('msgs are'.join(':',@msgs));
my ($awards) = split(/:/,$result);
my (@awards) = split(/,/,$awards);
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.139 loncom/homework/default_homework.lcpm:1.140
--- loncom/homework/default_homework.lcpm:1.139 Fri Sep 12 05:56:09 2008
+++ loncom/homework/default_homework.lcpm Fri Sep 12 22:08:32 2008
@@ -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.139 2008/09/12 09:56:09 raeburn Exp $
+# $Id: default_homework.lcpm,v 1.140 2008/09/13 02:08:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -259,7 +259,6 @@
sub caparesponse_check_list {
- my ($tag) = @_;
my $responses=$LONCAPA::CAPAresponse_args{'response'};
&LONCAPA_INTERNAL_DEBUG("args ".join(':',%LONCAPA::CAPAresponse_args));
my $type = $LONCAPA::CAPAresponse_args{'type'};
@@ -304,7 +303,7 @@
&LONCAPA_INTERNAL_DEBUG("Initial final response :$responses->[0][-1]:");
my $unit;
- if (($type eq 'float') || (($type eq '') && (($tag ne 'stringresponse') && ($tag ne 'stringhint')) ) ) {
+ if ($type eq 'float' || $type eq '') {
#for numerical problems split off the unit
# if ( $responses->[0][-1]=~ /(.*[^\s])\s+([^\s]+)/ ) {
if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/ ) {
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.232 loncom/homework/caparesponse/caparesponse.pm:1.233
--- loncom/homework/caparesponse/caparesponse.pm:1.232 Fri Sep 12 05:56:10 2008
+++ loncom/homework/caparesponse/caparesponse.pm Fri Sep 12 22:08:33 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.232 2008/09/12 09:56:10 raeburn Exp $
+# $Id: caparesponse.pm,v 1.233 2008/09/13 02:08:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -430,8 +430,12 @@
}
} elsif ($tag eq 'numericalresponse') {
$$args_ref{'type'}='float';
+ } elsif ($tag eq 'stringresponse') {
+ if ($$args_ref{'type'} eq '') {
+ $$args_ref{'type'} = 'ci';
+ }
}
-
+
&add_in_tag_answer($parstack,$safeeval);
if (!%answer) {
@@ -447,7 +451,7 @@
use Time::HiRes;
my $t0 = [Time::HiRes::gettimeofday()];
my ($result,@msgs) =
- &Apache::run::run("&caparesponse_check_list($tag)",$safeeval);
+ &Apache::run::run("&caparesponse_check_list()",$safeeval);
&Apache::lonxml::debug("checking $name $result with $response took ".&Time::HiRes::tv_interval($t0));
&Apache::lonxml::debug('msgs are '.join(':',@msgs));
my ($awards)=split(/:/,$result);
@@ -1161,13 +1165,15 @@
my @args = ('type');
my $args_ref = &setup_capa_args($safeeval,$parstack,
\@args,$response);
-
+ if ($$args_ref{'type'} eq '') {
+ $$args_ref{'type'} = 'ci';
+ }
&add_in_tag_answer($parstack,$safeeval);
my (@final_awards,@final_msgs,@names);
foreach my $name (keys(%answer)) {
&Apache::lonxml::debug(" doing $name with ".join(':',@{ $answer{$name}{'answers'} }));
${$safeeval->varglob('LONCAPA::CAPAresponse_answer')}=dclone($answer{$name});
- my ($result, @msgs)=&Apache::run::run("&caparesponse_check_list($$tagstack[-1])",$safeeval);
+ my ($result, @msgs)=&Apache::run::run("&caparesponse_check_list()",$safeeval);
&Apache::lonxml::debug('msgs are'.join(':',@msgs));
my ($awards)=split(/:/,$result);
my (@awards) = split(/,/,$awards);