--- loncom/homework/chemresponse.pm 2003/09/08 22:08:37 1.12
+++ loncom/homework/chemresponse.pm 2003/10/16 14:56:27 1.14
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.12 2003/09/08 22:08:37 albertel Exp $
+# $Id: chemresponse.pm,v 1.14 2003/10/16 14:56:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,7 +51,7 @@ SMILESECTION
JMESECTION
}
- if ($molecule) { $molecule=""; }
+ if ($molecule) { $molecule=''; }
my $body=<
@@ -175,15 +175,18 @@ sub end_organicresponse {
if ( $response =~ /[^\s]/) {
my $partid = $Apache::inputtags::part;
my $id = $Apache::inputtags::response['-1'];
- my $answer=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
+ my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
my %previous = &Apache::response::check_for_previous($response,$partid,$id);
$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
- &Apache::lonxml::debug("submitted a $response for $answer
\n");
my $ad;
- if ($response eq $answer) {
- $ad='EXACT_ANS';
- } else {
- $ad='INCORRECT';
+ foreach my $answer (@answers) {
+ &Apache::lonxml::debug("submitted a $response for $answer
\n");
+ if ($response eq $answer) {
+ $ad='EXACT_ANS';
+ last;
+ } else {
+ $ad='INCORRECT';
+ }
}
&Apache::response::handle_previous(\%previous,$ad);
$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad;
@@ -307,15 +310,17 @@ sub end_reactionresponse {
if ( $response =~ /[^\s]/) {
my $partid = $Apache::inputtags::part;
my $id = $Apache::inputtags::response['-1'];
- my $answer=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
+ my (@answers)=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
my %previous = &Apache::response::check_for_previous($response,$partid,$id);
$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
- &Apache::lonxml::debug("submitted a $response for $answer
\n");
my $ad;
- if ($response eq $answer) {
- $ad='EXACT_ANS';
- } else {
- $ad='INCORRECT';
+ foreach my $answer (@answers) {
+ &Apache::lonxml::debug("submitted a $response for $answer
\n");
+ if ($response eq $answer) {
+ $ad='EXACT_ANS';
+ } else {
+ $ad='INCORRECT';
+ }
}
&Apache::response::handle_previous(\%previous,$ad);
$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad;