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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 09 Oct 2003 14:50:01 -0000


matthew		Thu Oct  9 10:50:01 2003 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  Changes I forgot to commit so it may work now.  get_optionresponse_data
  now returns a pointer, restricts by students properly, and returns
  undef explicitly on errors.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.102 loncom/interface/loncoursedata.pm:1.103
--- loncom/interface/loncoursedata.pm:1.102	Tue Oct  7 11:30:09 2003
+++ loncom/interface/loncoursedata.pm	Thu Oct  9 10:50:01 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.102 2003/10/07 15:30:09 matthew Exp $
+# $Id: loncoursedata.pm,v 1.103 2003/10/09 14:50:01 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1987,9 +1987,11 @@
     return ();
 }
 
+#sub get_timestamp_data {
+#    my ($students,$symb,
 sub get_optionresponse_data {
     my ($students,$symb,$response,$courseid) = @_;
-    return if (! defined($symb) || 
+    return undef if (! defined($symb) || 
                ! defined($response));
     $courseid = $ENV{'request.course.id'} if (! defined($courseid));
     #
@@ -2012,19 +2014,19 @@
         'a.symb_id='.$symb_id.' AND a.response_id='.$response_id;
     if (defined($students)) {
         $request .= ' AND ('.
-            join(' OR ', map {'student_id='.
+            join(' OR ', map {'a.student_id='.
                                   &get_student_id($_->{'username'},
                                                   $_->{'domain'})
                               } @$students
                  ).')';
     }
     $request .= ' ORDER BY b.timestamp';
-    &Apache::lonnet::logthis("request =\n".$request);
+#    &Apache::lonnet::logthis("request =\n".$request);
     my $sth = $dbh->prepare($request);
     $sth->execute();
     my $dataset = $sth->fetchall_arrayref();
     if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) {
-        return @$dataset;
+        return $dataset;
     }
 }