version 1.93, 2003/09/30 15:34:34
|
version 1.97, 2003/10/01 20:50:13
|
Line 1353 sub update_student_data {
|
Line 1353 sub update_student_data {
|
my @Results = &store_student_data($sname,$sdom,$courseid,\%student_data); |
my @Results = &store_student_data($sname,$sdom,$courseid,\%student_data); |
# |
# |
# Set the students update time |
# Set the students update time |
&Apache::lonmysql::replace_row($studentdata_table, |
if ($Results[0] eq 'okay') { |
|
&Apache::lonmysql::replace_row($studentdata_table, |
[$student_id,$time_of_retrieval,undef,undef,undef]); |
[$student_id,$time_of_retrieval,undef,undef,undef]); |
|
} |
# |
# |
return @Results; |
return @Results; |
} |
} |
Line 1433 sub store_student_data {
|
Line 1435 sub store_student_data {
|
chop $store_performance_command; |
chop $store_performance_command; |
chop $store_performance_command; |
chop $store_performance_command; |
my $start = Time::HiRes::time; |
my $start = Time::HiRes::time; |
|
$dbh->do($store_performance_command); |
|
if ($dbh->err()) { |
|
&Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); |
|
&Apache::lonnet::logthis('command = '.$store_performance_command); |
|
$returnstatus = 'error: unable to insert performance into database'; |
|
return ($returnstatus,$student_data); |
|
} |
$dbh->do($store_parameters_command) if ($num_parameters>0); |
$dbh->do($store_parameters_command) if ($num_parameters>0); |
if ($dbh->err()) { |
if ($dbh->err()) { |
&Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); |
&Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); |
Line 1442 sub store_student_data {
|
Line 1451 sub store_student_data {
|
$returnstatus = 'error: unable to insert parameters into database'; |
$returnstatus = 'error: unable to insert parameters into database'; |
return ($returnstatus,$student_data); |
return ($returnstatus,$student_data); |
} |
} |
$dbh->do($store_performance_command); |
|
if ($dbh->err()) { |
|
&Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); |
|
&Apache::lonnet::logthis('command = '.$store_performance_command); |
|
$returnstatus = 'error: unable to insert performance into database'; |
|
return ($returnstatus,$student_data); |
|
} |
|
$elapsed += Time::HiRes::time - $start; |
$elapsed += Time::HiRes::time - $start; |
return ($returnstatus,$student_data); |
return ($returnstatus,$student_data); |
} |
} |
Line 1678 sub get_student_data_from_performance_ca
|
Line 1680 sub get_student_data_from_performance_ca
|
$studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail; |
$studentdata->{$symb}->{$base.'.awarddetail'} = $awarddetail; |
$studentdata->{$symb}->{'timestamp'} = $time if (defined($time) && $time ne ''); |
$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 '') { |
if (defined($symb) && $symb ne '') { |
$studentdata = $studentdata->{$symb}; |
$studentdata = $studentdata->{$symb}; |
} |
} |