[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

raeburn raeburn@source.lon-capa.org
Sat, 26 Feb 2011 17:50:13 -0000


raeburn		Sat Feb 26 17:50:13 2011 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - Efficiency: use a single loop to check for control characters and populate
    answerstring for stringreponse.
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.151 loncom/homework/default_homework.lcpm:1.152
--- loncom/homework/default_homework.lcpm:1.151	Thu Dec 16 16:01:01 2010
+++ loncom/homework/default_homework.lcpm	Sat Feb 26 17:50:13 2011
@@ -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.151 2010/12/16 16:01:01 raeburn Exp $
+# $Id: default_homework.lcpm,v 1.152 2011/02/26 17:50:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -364,6 +364,7 @@
         if (ref($LONCAPA::CAPAresponse_answer->{'answers'}) eq 'ARRAY') {
             foreach my $strans (@{$LONCAPA::CAPAresponse_answer->{'answers'}}) {
                 if (ref($strans) eq 'ARRAY') {
+                    $ansstring = join("\0",@{$strans});
                     foreach my $item (@{$strans}) {  
                         if ($item =~ /[\000-\037]/) {
                             $allow_control_char = 1;
@@ -373,15 +374,6 @@
             }
         }
     }
-    if (($type eq 'cs') || ($type eq 'ci')) {
-        if (ref($LONCAPA::CAPAresponse_answer->{'answers'}) eq 'ARRAY') {
-            foreach my $answer (@{ $LONCAPA::CAPAresponse_answer->{'answers'} }) {
-                if (ref($answer) eq 'ARRAY') {
-                    $ansstring = join("\0",@{$answer});
-                }
-            }
-        }
-    }
 
 #    &LONCAPA_INTERNAL_DEBUG(&LONCAPA_INTERNAL_Dumper($responses));
     my %memoized;