[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

raeburn raeburn at source.lon-capa.org
Thu Sep 13 22:51:39 EDT 2018


raeburn		Fri Sep 14 02:51:39 2018 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - Bug 6844
    numericalresponse with answergroup supports $ (dollar) as a unit.
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.259 loncom/homework/caparesponse/caparesponse.pm:1.260
--- loncom/homework/caparesponse/caparesponse.pm:1.259	Thu Sep 13 17:00:05 2018
+++ loncom/homework/caparesponse/caparesponse.pm	Fri Sep 14 02:51:39 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.259 2018/09/13 17:00:05 raeburn Exp $
+# $Id: caparesponse.pm,v 1.260 2018/09/14 02:51:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -760,7 +760,11 @@
 		my $ans=$answers[$i];
 		my $fmt=$formats[0];
 		if (@formats && $#formats) {$fmt=$formats[$i];}
-		foreach my $element (@$ans) {		    
+		my @answers;
+		if (ref($ans) eq 'ARRAY') {
+		    @answers = (@{$ans});
+		}
+		foreach my $element (@answers) {		    
 		    if ($fmt && $tag eq 'numericalresponse') {
 			$fmt=~s/e/E/g;
 			if ($unit=~/\$/) { $fmt="\$".$fmt; $unit=~s/\$//g; }
@@ -770,7 +774,7 @@
 			if ($fmt=~/\$/ && !$needsdollar) { $element=~s/\$//; }
 		    }
 		}
-		push(@fmt_ans,join(',',@$ans));
+		push(@fmt_ans,join(',', at answers));
 	    }
 	    my $response=\@fmt_ans;
 




More information about the LON-CAPA-cvs mailing list