--- loncom/interface/loncoursedata.pm 2004/07/06 15:50:03 1.137 +++ loncom/interface/loncoursedata.pm 2004/07/22 15:55:57 1.138 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.137 2004/07/06 15:50:03 matthew Exp $ +# $Id: loncoursedata.pm,v 1.138 2004/07/22 15:55:57 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2303,6 +2303,14 @@ sub get_sum_of_scores { if (! defined($courseid)) { $courseid = $ENV{'request.course.id'}; } + if (defined($students) && + ((@$students == 0) || + (@$students == 1 && (! defined($students->[0]) || + $students->[0] eq '')) + ) + ){ + undef($students); + } # &setup_table_names($courseid); my $dbh = &Apache::lonmysql::get_dbh(); @@ -2325,7 +2333,9 @@ sub get_sum_of_scores { $sth->execute(); my $rows = $sth->fetchrow_arrayref(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 1 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed, fetchrow_arrayrefed'. + $/.$request); return (undef,undef); } return ($rows->[0],$rows->[1]); @@ -2505,7 +2515,8 @@ sub get_student_data { my $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 2 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } my $dataset = $sth->fetchall_arrayref(); @@ -2574,7 +2585,8 @@ sub get_response_data { my $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 3 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } my $dataset = $sth->fetchall_arrayref(); @@ -2630,7 +2642,8 @@ sub get_response_data_by_student { my $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 4 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } my $dataset = $sth->fetchall_arrayref(); @@ -2682,7 +2695,8 @@ sub get_response_time_data { my $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 5 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } my $dataset = $sth->fetchall_arrayref(); @@ -2772,7 +2786,8 @@ sub get_student_scores { my $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 6 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } $request = 'SELECT score,COUNT(*) FROM '.$tmptable.' GROUP BY score'; @@ -2780,7 +2795,8 @@ sub get_student_scores { $sth = $dbh->prepare($request); $sth->execute(); if ($dbh->err) { - &Apache::lonnet::logthis('error = '.$dbh->errstr()); + &Apache::lonnet::logthis('error 7 = '.$dbh->errstr()); + &Apache::lonnet::logthis('prepared then executed '.$/.$request); return undef; } my $dataset = $sth->fetchall_arrayref();