version 1.115, 2004/02/03 20:44:06
|
version 1.120, 2004/02/18 20:48:21
|
Line 1235 sub update_full_student_data {
|
Line 1235 sub update_full_student_data {
|
# However, there is one wrinkle: submissions which end in |
# However, there is one wrinkle: submissions which end in |
# and odd number of '\' cause insert errors to occur. |
# and odd number of '\' cause insert errors to occur. |
# Best trap this somehow... |
# Best trap this somehow... |
$value =~ s/\'/\\\'/g; |
$value = $dbh->quote($value); |
my ($offensive_string) = ($value =~ /(\\+)$/); |
|
if (length($offensive_string) % 2) { |
|
$value =~ s/\\$/\\\\/; |
|
} |
|
} |
} |
if ($field eq 'submissiongrading' || |
if ($field eq 'submissiongrading' || |
$field eq 'molecule') { |
$field eq 'molecule') { |
Line 2111 sub get_response_data {
|
Line 2107 sub get_response_data {
|
} |
} |
my $dataset = $sth->fetchall_arrayref(); |
my $dataset = $sth->fetchall_arrayref(); |
if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { |
if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { |
|
# Clear the \'s from around the submission |
|
for (my $i =0;$i<scalar(@$dataset);$i++) { |
|
$dataset->[$i]->[3] =~ s/(\'$|^\')//g; |
|
} |
|
return $dataset; |
|
} |
|
} |
|
|
|
|
|
sub RDs_awarddetail { return 3; } |
|
sub RDs_submission { return 2; } |
|
sub RDs_timestamp { return 1; } |
|
sub RDs_tries { return 0; } |
|
sub RDs_awarded { return 4; } |
|
|
|
sub get_response_data_by_student { |
|
my ($student,$symb,$response,$courseid) = @_; |
|
return undef if (! defined($symb) || |
|
! defined($response)); |
|
$courseid = $ENV{'request.course.id'} if (! defined($courseid)); |
|
# |
|
&setup_table_names($courseid); |
|
my $symb_id = &get_symb_id($symb); |
|
my $response_id = &get_part_id($response); |
|
# |
|
my $student_id = &get_student_id($student->{'username'}, |
|
$student->{'domain'}); |
|
# |
|
my $dbh = &Apache::lonmysql::get_dbh(); |
|
return undef if (! defined($dbh)); |
|
my $request = 'SELECT '. |
|
'c.tries, b.timestamp, a.submission, a.awarddetail, e.awarded '. |
|
'FROM '.$fulldump_response_table.' AS a '. |
|
'LEFT JOIN '.$fulldump_timestamp_table.' AS b '. |
|
'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '. |
|
'a.transaction = b.transaction '. |
|
'LEFT JOIN '.$fulldump_part_table.' AS c '. |
|
'ON a.symb_id=c.symb_id AND a.student_id=c.student_id AND '. |
|
'a.part_id=c.part_id AND a.transaction = c.transaction '. |
|
'LEFT JOIN '.$student_table.' AS d '. |
|
'ON a.student_id=d.student_id '. |
|
'LEFT JOIN '.$performance_table.' AS e '. |
|
'ON a.symb_id=e.symb_id AND a.part_id=e.part_id AND '. |
|
'a.student_id=e.student_id AND c.tries=e.tries '. |
|
'WHERE '. |
|
'a.symb_id='.$symb_id.' AND a.response_id='.$response_id. |
|
' AND a.student_id='.$student_id.' ORDER BY b.timestamp'; |
|
# &Apache::lonnet::logthis("request =\n".$request); |
|
my $sth = $dbh->prepare($request); |
|
$sth->execute(); |
|
if ($dbh->err) { |
|
&Apache::lonnet::logthis('error = '.$dbh->errstr()); |
|
return undef; |
|
} |
|
my $dataset = $sth->fetchall_arrayref(); |
|
if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { |
|
# Clear the \'s from around the submission |
|
for (my $i =0;$i<scalar(@$dataset);$i++) { |
|
$dataset->[$i]->[2] =~ s/(\'$|^\')//g; |
|
} |
return $dataset; |
return $dataset; |
} |
} |
|
return undef; # error occurred |
} |
} |
|
|
sub RT_student_id { return 0; } |
sub RT_student_id { return 0; } |
Line 2168 sub get_response_time_data {
|
Line 2225 sub get_response_time_data {
|
|
|
=pod |
=pod |
|
|
=item &get_student_scores($Students,$Symbs,$enrollment,$courseid) |
=item &get_student_scores($Sections,$Symbs,$enrollment,$courseid) |
|
|
=cut |
=cut |
|
|