--- loncom/homework/grades.pm 2005/06/04 02:56:44 1.270
+++ loncom/homework/grades.pm 2005/06/13 20:23:54 1.275
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.270 2005/06/04 02:56:44 albertel Exp $
+# $Id: grades.pm,v 1.275 2005/06/13 20:23:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2273,18 +2273,14 @@ sub get_last_resets {
my %last_resets;
my $cdom = $env{'course.'.$courseid.'.domain'};
my $cname = $env{'course.'.$courseid.'.num'};
- my %resethash = &Apache::lonnet::restore($symb,'nohist_resourcetracker',
- $cdom,$cname);
- if ($resethash{'version'}) {
- foreach my $part (@{$partids}) {
- $last_resets{$part} = '';
- for (my $version=$resethash{'version'};$version>=1;$version--) {
- if (exists($resethash{$version.':'.$part."\0".'prev_attempts'})) {
- $last_resets{$part} = $resethash{$version.':timestamp'};
- last;
- }
- }
- }
+ my @keys;
+ foreach my $part (@{$partids}) {
+ push(@keys,"$symb\0$part\0resettime");
+ }
+ my %results=&Apache::lonnet::get('nohist_resourcetracker',\@keys,
+ $cdom,$cname);
+ foreach my $part (@{$partids}) {
+ $last_resets{$part}=$results{"$symb\0$part\0resettime"};
}
return %last_resets;
}
@@ -2325,12 +2321,11 @@ sub version_portfiles {
}
}
$version++;
- my $home_server = &Apache::lonnet::homeserver($stuname,$domain,undef);
$env{'form.copy'} = &Apache::lonnet::getfile("/uploaded/$domain/$stuname/portfolio$directory$answer_file");
if($env{'form.copy'} eq '-1') {
&Apache::lonnet::logthis('problem getting file '.$directory.$answer_file);
} else {
- my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,$home_server,'copy',
+ my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,'copy',
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
&Apache::lonnet::mark_as_readonly($domain,$stuname,
@@ -3877,12 +3872,12 @@ sub scantron_CODElist {
sub scantron_CODEunique {
my $result='
How should I handle this? There have been multiple bubbles scanned for a some question(s)
\n");
$r->print("\n
");
my $i=0;
- if ($error eq 'incorrectCODE') {
+ if ($error eq 'incorrectCODE'
+ && $$scan_record{'scantron.CODE'}=~/\S/ ) {
my ($max,$closest)=&scantron_get_closely_matching_CODEs($arg,$$scan_record{'scantron.CODE'});
foreach my $testcode (@{$closest}) {
my $checked='';
if (!$i) { $checked=' checked="on" '; }
- $r->print(" Use the similar CODE ".$testcode." instead.");
+ $r->print("");
$r->print("\n
");
$i++;
}
}
- my $checked; if (!$i) { $checked=' checked="on" '; }
- $r->print(" Use the CODE ".$$scan_record{'scantron.CODE'}." that is was on the paper, ignoring the error.");
- $r->print("\n
");
+ if ($$scan_record{'scantron.CODE'}=~/\S/ ) {
+ my $checked; if (!$i) { $checked=' checked="on" '; }
+ $r->print("");
+ $r->print("\n
");
+ }
$r->print(<
");
- $r->print(" Use as the CODE.");
+ $r->print(" as the CODE.");
$r->print("\n
");
} elsif ($error eq 'doublebubble') {
$r->print("
');
}
@@ -5139,8 +5156,6 @@ sub scantron_upload_scantron_data_save {
}
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'});
$r->print("Doing upload to ".$coursedata{'description'}." $quest ");
for (my $i=0;$i<$max+1;$i++) {
- $r->print('');
+ $r->print("\n".' ');
if ($selected[0] eq $alphabet[$i]) { $r->print('X'); shift(@selected) }
else { $r->print(' '); }
$r->print(' ');
}
- $r->print('');
+ $r->print(' ');
for (my $i=0;$i<$max;$i++) {
- $r->print(' '.$alphabet[$i]." ");
+ $r->print("\n".
+ '");
}
- $r->print(' No bubble ');
+ $r->print('');
$r->print('
");
- my $home=&Apache::lonnet::homeserver($env{'form.courseid'},
- $env{'form.domainid'});
my $fname=$env{'form.upfile.filename'};
#FIXME
#copied from lonnet::userfileupload()
@@ -5160,7 +5175,7 @@ sub scantron_upload_scantron_data_save {
if (length($env{'form.upfile'}) < 2) {
$r->print("Error: The file you attempted to upload, ".&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').", contained no information. Please check that you entered the correct filename.");
} else {
- my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},$home,'upfile',$fname);
+ my $result=&Apache::lonnet::finishuserfileupload($env{'form.courseid'},$env{'form.domainid'},'upfile',$fname);
if ($result =~ m|^/uploaded/|) {
$r->print("Success: Successfully uploaded ".(length($env{'form.upfile'})-1)." bytes of data into location ".$result."");
} else {