version 1.100, 2003/10/02 20:48:57
|
version 1.104, 2003/10/17 21:36:10
|
Line 1222 sub update_full_student_data {
|
Line 1222 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; |
my ($offensive_string) = ($value =~ /(\\+)$/); |
my ($offensive_string) = ($value =~ /(\\+)$/); |
if (length($offensive_string) % 2) { |
if (length($offensive_string) % 2) { |
$value =~ s/\\$/\\\\/; |
$value =~ s/\\$/\\\\/; |
Line 1248 sub update_full_student_data {
|
Line 1249 sub update_full_student_data {
|
$store_command .= "('".join("','",$symb_id,$part_id, |
$store_command .= "('".join("','",$symb_id,$part_id, |
$student_id, |
$student_id, |
$transaction, |
$transaction, |
|
$data->{'tries'}, |
$data->{'award'}, |
$data->{'award'}, |
$data->{'awarded'}, |
$data->{'awarded'}, |
$data->{'previous'})."'),"; |
$data->{'previous'})."'),"; |
Line 1276 sub update_full_student_data {
|
Line 1278 sub update_full_student_data {
|
$store_command .= "('".join("','",$symb_id,$part_id, |
$store_command .= "('".join("','",$symb_id,$part_id, |
$resp_id,$student_id, |
$resp_id,$student_id, |
$transaction, |
$transaction, |
$data->{'tries'}, |
|
$data->{'awarddetail'}, |
$data->{'awarddetail'}, |
$data->{'response_specific'}, |
$data->{'response_specific'}, |
$data->{'response_specific_value'}, |
$data->{'response_specific_value'}, |
Line 1986 sub execute_SQL_request {
|
Line 1987 sub execute_SQL_request {
|
return (); |
return (); |
} |
} |
|
|
|
#sub get_timestamp_data { |
|
# my ($students,$symb, |
sub get_optionresponse_data { |
sub get_optionresponse_data { |
my ($students,$symb,$response,$courseid) = @_; |
my ($students,$symb,$response,$courseid) = @_; |
return if (! defined($symb) || |
return undef if (! defined($symb) || |
! defined($response)); |
! defined($response)); |
$courseid = $ENV{'request.course.id'} if (! defined($courseid)); |
$courseid = $ENV{'request.course.id'} if (! defined($courseid)); |
# |
# |
Line 1999 sub get_optionresponse_data {
|
Line 2002 sub get_optionresponse_data {
|
my $dbh = &Apache::lonmysql::get_dbh(); |
my $dbh = &Apache::lonmysql::get_dbh(); |
return undef if (! defined($dbh)); |
return undef if (! defined($dbh)); |
my $request = 'SELECT '. |
my $request = 'SELECT '. |
'a.response_specific_value, a.submission, b.timestamp, c.tries '. |
'a.awarddetail, a.response_specific_value, a.submission, '. |
|
'b.timestamp, c.tries '. |
'FROM '.$fulldump_response_table.' AS a '. |
'FROM '.$fulldump_response_table.' AS a '. |
'LEFT JOIN '.$fulldump_timestamp_table.' AS b '. |
'LEFT JOIN '.$fulldump_timestamp_table.' AS b '. |
'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '. |
'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '. |
Line 2011 sub get_optionresponse_data {
|
Line 2015 sub get_optionresponse_data {
|
'a.symb_id='.$symb_id.' AND a.response_id='.$response_id; |
'a.symb_id='.$symb_id.' AND a.response_id='.$response_id; |
if (defined($students)) { |
if (defined($students)) { |
$request .= ' AND ('. |
$request .= ' AND ('. |
join(' OR ', map {'student_id='. |
join(' OR ', map {'a.student_id='. |
&get_student_id($_->{'username'}, |
&get_student_id($_->{'username'}, |
$_->{'domain'}) |
$_->{'domain'}) |
} @$students |
} @$students |
).')'; |
).')'; |
} |
} |
$request .= ' ORDER BY b.timestamp'; |
$request .= ' ORDER BY b.timestamp'; |
&Apache::lonnet::logthis("request =\n".$request); |
# &Apache::lonnet::logthis("request =\n".$request); |
my $sth = $dbh->prepare($request); |
my $sth = $dbh->prepare($request); |
$sth->execute(); |
$sth->execute(); |
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) { |
return @$dataset; |
return $dataset; |
} |
} |
} |
} |
|
|