version 1.146, 2005/04/07 06:56:23
|
version 1.147, 2005/04/19 00:44:31
|
Line 1270 sub store_student_data {
|
Line 1270 sub store_student_data {
|
# make sure the symb is set up properly |
# make sure the symb is set up properly |
my $symb_id = &get_symb_id($current_symb); |
my $symb_id = &get_symb_id($current_symb); |
# |
# |
# Load data into the tables |
# Parameters |
while (my ($parameter,$value) = each(%$param_hash)) { |
while (my ($parameter,$value) = each(%$param_hash)) { |
my $newstring; |
|
if ($parameter !~ /(timestamp|resource\.(.*)\.(solved|tries|awarded|award|awarddetail|previous))/) { |
if ($parameter !~ /(timestamp|resource\.(.*)\.(solved|tries|awarded|award|awarddetail|previous))/) { |
$newstring = "('".join("','", |
my $sql_parameter = "('".join("','", |
$symb_id,$student_id, |
$symb_id,$student_id, |
$parameter)."',". |
$parameter)."',". |
$dbh->quote($value)."),\n"; |
$dbh->quote($value)."),\n"; |
$num_parameters ++; |
$num_parameters ++; |
if ($newstring !~ /''/) { |
if ($sql_parameter !~ /''/) { |
$store_parameters_command .= $newstring; |
$store_parameters_command .= $sql_parameter; |
$rows_stored++; |
$rows_stored++; |
} |
} |
} |
} |
next if ($parameter !~ /^resource\.(.*)\.solved$/); |
} |
# |
# Performance |
|
my %stored; |
|
while (my ($parameter,$value) = each(%$param_hash)) { |
|
next if ($parameter !~ /^resource\.(.*)\.(solved|awarded)$/); |
my $part = $1; |
my $part = $1; |
|
next if (exists($stored{$part})); |
|
$stored{$part}++; |
|
# |
my $part_id = &get_part_id($part); |
my $part_id = &get_part_id($part); |
next if (!defined($part_id)); |
next if (!defined($part_id)); |
my $solved = $value; |
my $solved = $value; |
Line 1301 sub store_student_data {
|
Line 1306 sub store_student_data {
|
$awarded = '' if (! defined($awarded)); |
$awarded = '' if (! defined($awarded)); |
$award = '' if (! defined($award)); |
$award = '' if (! defined($award)); |
$awarddetail = '' if (! defined($awarddetail)); |
$awarddetail = '' if (! defined($awarddetail)); |
$newstring = "('".join("','",$symb_id,$student_id,$part_id,$part, |
my $sql_performance = |
$solved,$tries,$awarded,$award, |
"('".join("','",$symb_id,$student_id,$part_id,$part, |
$awarddetail,$timestamp)."'),\n"; |
$solved,$tries,$awarded,$award, |
$store_performance_command .= $newstring; |
$awarddetail,$timestamp)."'),\n"; |
|
$store_performance_command .= $sql_performance; |
$rows_stored++; |
$rows_stored++; |
} |
} |
} |
} |
chop $store_parameters_command; |
$store_parameters_command =~ s|,\n$||; |
chop $store_parameters_command; |
$store_performance_command =~ s|,\n$||; |
chop $store_performance_command; |
|
chop $store_performance_command; |
|
my $start = Time::HiRes::time; |
my $start = Time::HiRes::time; |
$dbh->do($store_performance_command); |
$dbh->do($store_performance_command); |
if ($dbh->err()) { |
if ($dbh->err()) { |
&Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); |
&Apache::lonnet::logthis('performance bigass insert error:'. |
&Apache::lonnet::logthis('command = '.$store_performance_command); |
$dbh->errstr()); |
|
&Apache::lonnet::logthis('command = '.$/.$store_performance_command); |
$returnstatus = 'error: unable to insert performance into database'; |
$returnstatus = 'error: unable to insert performance into database'; |
return ($returnstatus,$student_data); |
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('parameters bigass insert error:'. |
&Apache::lonnet::logthis('command = '.$store_parameters_command); |
$dbh->errstr()); |
|
&Apache::lonnet::logthis('command = '.$/.$store_parameters_command); |
&Apache::lonnet::logthis('rows_stored = '.$rows_stored); |
&Apache::lonnet::logthis('rows_stored = '.$rows_stored); |
&Apache::lonnet::logthis('student_id = '.$student_id); |
&Apache::lonnet::logthis('student_id = '.$student_id); |
$returnstatus = 'error: unable to insert parameters into database'; |
$returnstatus = 'error: unable to insert parameters into database'; |