version 1.135, 2004/06/15 14:12:56
|
version 1.138, 2004/07/22 15:55:57
|
Line 2303 sub get_sum_of_scores {
|
Line 2303 sub get_sum_of_scores {
|
if (! defined($courseid)) { |
if (! defined($courseid)) { |
$courseid = $ENV{'request.course.id'}; |
$courseid = $ENV{'request.course.id'}; |
} |
} |
|
if (defined($students) && |
|
((@$students == 0) || |
|
(@$students == 1 && (! defined($students->[0]) || |
|
$students->[0] eq '')) |
|
) |
|
){ |
|
undef($students); |
|
} |
# |
# |
&setup_table_names($courseid); |
&setup_table_names($courseid); |
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
Line 2325 sub get_sum_of_scores {
|
Line 2333 sub get_sum_of_scores {
|
$sth->execute(); |
$sth->execute(); |
my $rows = $sth->fetchrow_arrayref(); |
my $rows = $sth->fetchrow_arrayref(); |
if ($dbh->err) { |
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 (undef,undef); |
} |
} |
return ($rows->[0],$rows->[1]); |
return ($rows->[0],$rows->[1]); |
Line 2505 sub get_student_data {
|
Line 2515 sub get_student_data {
|
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
Line 2530 sub get_response_data {
|
Line 2541 sub get_response_data {
|
# |
# |
&setup_table_names($courseid); |
&setup_table_names($courseid); |
my $symb_id = &get_symb_id($symb); |
my $symb_id = &get_symb_id($symb); |
|
if (! defined($symb_id)) { |
|
&Apache::lonnet::logthis('Unable to find symb for '.$symb.' in '.$courseid); |
|
return undef; |
|
} |
my $response_id = &get_part_id($response); |
my $response_id = &get_part_id($response); |
|
if (! defined($response_id)) { |
|
&Apache::lonnet::logthis('Unable to find id for '.$response.' in '.$courseid); |
|
return undef; |
|
} |
# |
# |
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
return undef if (! defined($dbh)); |
return undef if (! defined($dbh)); |
Line 2566 sub get_response_data {
|
Line 2585 sub get_response_data {
|
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
Line 2622 sub get_response_data_by_student {
|
Line 2642 sub get_response_data_by_student {
|
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
Line 2674 sub get_response_time_data {
|
Line 2695 sub get_response_time_data {
|
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
Line 2764 sub get_student_scores {
|
Line 2786 sub get_student_scores {
|
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
$request = 'SELECT score,COUNT(*) FROM '.$tmptable.' GROUP BY score'; |
$request = 'SELECT score,COUNT(*) FROM '.$tmptable.' GROUP BY score'; |
Line 2772 sub get_student_scores {
|
Line 2795 sub get_student_scores {
|
$sth = $dbh->prepare($request); |
$sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
if ($dbh->err) { |
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; |
return undef; |
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
Line 2879 $ENV{'course.'.$cid.'.domain'}, and $ENV
|
Line 2903 $ENV{'course.'.$cid.'.domain'}, and $ENV
|
|
|
Returns a reference to a hash which contains: |
Returns a reference to a hash which contains: |
keys '$sname:$sdom' |
keys '$sname:$sdom' |
values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type] |
values [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype] |
|
|
The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used |
The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used |
as indices into the returned list to future-proof clients against |
as indices into the returned list to future-proof clients against |
Line 2899 sub CL_SECTION { return 5; }
|
Line 2923 sub CL_SECTION { return 5; }
|
sub CL_FULLNAME { return 6; } |
sub CL_FULLNAME { return 6; } |
sub CL_STATUS { return 7; } |
sub CL_STATUS { return 7; } |
sub CL_TYPE { return 8; } |
sub CL_TYPE { return 8; } |
|
sub CL_LOCKEDTYPE { return 9; } |
|
|
sub get_classlist { |
sub get_classlist { |
my ($cid,$cdom,$cnum) = @_; |
my ($cid,$cdom,$cnum) = @_; |
Line 2915 sub get_classlist {
|
Line 2940 sub get_classlist {
|
} |
} |
my ($sname,$sdom) = split(/:/,$student); |
my ($sname,$sdom) = split(/:/,$student); |
my @Values = split(/:/,$info); |
my @Values = split(/:/,$info); |
my ($end,$start,$id,$section,$fullname,$type); |
my ($end,$start,$id,$section,$fullname,$type,$lockedtype); |
if (@Values > 2) { |
if (@Values > 2) { |
($end,$start,$id,$section,$fullname,$type) = @Values; |
($end,$start,$id,$section,$fullname,$type,$lockedtype) = @Values; |
} else { # We have to get the data ourselves |
} else { # We have to get the data ourselves |
($end,$start) = @Values; |
($end,$start) = @Values; |
$section = &Apache::lonnet::getsection($sdom,$sname,$cid); |
$section = &Apache::lonnet::getsection($sdom,$sname,$cid); |
Line 2954 sub get_classlist {
|
Line 2979 sub get_classlist {
|
$status='Active'; |
$status='Active'; |
} |
} |
$classlist{$student} = |
$classlist{$student} = |
[$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type]; |
[$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,$lockedtype]; |
} |
} |
if (wantarray()) { |
if (wantarray()) { |
return (\%classlist,['domain','username','end','start','id', |
return (\%classlist,['domain','username','end','start','id', |
'section','fullname','status','type']); |
'section','fullname','status','type','lockedtype']); |
} else { |
} else { |
return \%classlist; |
return \%classlist; |
} |
} |