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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 01 Oct 2003 20:50:13 -0000


matthew		Wed Oct  1 16:50:13 2003 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  &get_student_data_from_performance_cache:
  Pick up all parameters all the time when asked for student data, instead of
  just returning the known relevant ones.
  Include in 1.0.2
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.96 loncom/interface/loncoursedata.pm:1.97
--- loncom/interface/loncoursedata.pm:1.96	Tue Sep 30 11:47:40 2003
+++ loncom/interface/loncoursedata.pm	Wed Oct  1 16:50:13 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.96 2003/09/30 15:47:40 matthew Exp $
+# $Id: loncoursedata.pm,v 1.97 2003/10/01 20:50:13 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1680,6 +1680,33 @@
         $studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail;
         $studentdata->{$symb}->{'timestamp'} = $time if (defined($time) && $time ne '');
     }
+    ## Get misc parameters
+    $request = 'SELECT c.symb,a.parameter,a.value '.
+        "FROM $student_table AS b ".
+        "LEFT JOIN $parameters_table AS a ON b.student_id=a.student_id ".
+        "LEFT JOIN $symb_table AS c ON c.symb_id = a.symb_id ".
+        "WHERE student='$student'";
+    if (defined($symb) && $symb ne '') {
+        $request .= " AND c.symb=".$dbh->quote($symb);
+    }
+    $sth = $dbh->prepare($request);
+    $sth->execute();
+    if ($sth->err()) {
+        &Apache::lonnet::logthis("Unable to execute MySQL request:");
+        &Apache::lonnet::logthis("\n".$request."\n");
+        &Apache::lonnet::logthis("error is:".$sth->errstr());
+        if (defined($symb) && $symb ne '') {
+            $studentdata = $studentdata->{$symb};
+        }
+        return $studentdata;
+    }
+    #
+    foreach my $row (@{$sth->fetchall_arrayref}) {
+        $rows_retrieved++;
+        my ($symb,$parameter,$value) = (@$row);
+        $studentdata->{$symb}->{$parameter}  = $value;
+    }
+    #
     if (defined($symb) && $symb ne '') {
         $studentdata = $studentdata->{$symb};
     }