[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstathelpers.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 29 Dec 2006 21:47:15 -0000


albertel		Fri Dec 29 16:47:15 2006 EDT

  Modified files:              
    /loncom/interface/statistics	lonstathelpers.pm 
  Log:
  - BUG#5118 - analyzing numeircal problem was causing ISE
  
  
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.53 loncom/interface/statistics/lonstathelpers.pm:1.54
--- loncom/interface/statistics/lonstathelpers.pm:1.53	Tue May 30 08:46:50 2006
+++ loncom/interface/statistics/lonstathelpers.pm	Fri Dec 29 16:47:11 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.53 2006/05/30 12:46:50 www Exp $
+# $Id: lonstathelpers.pm,v 1.54 2006/12/29 21:47:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -736,11 +736,16 @@
     my ($prefix,$key,%Answer) = @_;
     my $returnvalue;
     if (exists($Answer{$key})) {
-        my $student_answer = $Answer{$key}->[0];
-        if (! defined($student_answer)) {
-            $student_answer = $Answer{$key}->[1];
-        }
-        $returnvalue = $student_answer;
+	if (ref($Answer{$key}) eq 'HASH') {
+	    my $which = 'INTERNAL';
+	    if (!exists($Answer{$key}{$which})) {
+		$which = (sort(keys(%{ $Answer{$key} })))[0];
+	    }
+	    my $student_answer = $Answer{$key}{$which}[0][0];
+	    $returnvalue = $student_answer; 
+	} else {
+	    &Apache::lonnet::logthis("error analyzing problem. got a answer of type ".ref($Answer{$key}));
+	}
     } else {
         if (exists($Answer{$prefix.'.shown'})) {
             # The response has foils