--- loncom/homework/grades.pm 2005/06/04 19:05:31 1.273
+++ loncom/homework/grades.pm 2005/09/01 15:23:23 1.282
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.273 2005/06/04 19:05:31 albertel Exp $
+# $Id: grades.pm,v 1.282 2005/09/01 15:23:23 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -471,6 +471,10 @@ sub most_similar {
$uessay=~s/\W+/ /gs;
+# ignore empty submissions (occuring when only files are sent)
+
+ unless ($uessay=~/\w+/) { return ''; }
+
# these will be returned. Do not care if not at least 50 percent similar
my $limit=0.6;
my $sname='';
@@ -743,7 +747,7 @@ LISTJAVASCRIPT
if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
foreach (sort keys(%status)) {
next if (/^resource.*?submitted_by$/);
- $gradeTable.='
'.$status{$_}.'
'."\n";
+ $gradeTable.='
'.$status{$_}.'
'."\n";
}
}
# $gradeTable.='
' if ($ctr%2 ==1);
@@ -2293,12 +2297,13 @@ sub version_portfiles {
my $portfolio_root = &Apache::loncommon::propath($domain,
$stuname).
'/userfiles/portfolio';
- foreach my $key(keys %$record) {
+ foreach my $key (keys(%$record)) {
my $new_portfiles;
+
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) {
my @v_portfiles;
my @portfiles = split(/,/,$$record{$key});
- # &Apache::lonnet::logthis("should be unmarking and remarking");
+ &Apache::lonnet::logthis("should be unmarking and remarking $key",@portfiles);
foreach my $file (@portfiles) {
&Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file);
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/);
@@ -2321,12 +2326,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,
@@ -2656,7 +2660,6 @@ sub viewgrades {
sub viewstudentgrade {
my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;
my ($uname,$udom) = split(/:/,$student);
- $student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my %aggregates = ();
my $result='
'."\n";
+ $student=~s/:/_/; # colon doen't work in javascript for names
foreach my $apart (@$parts) {
my ($part,$type) = &split_part_type($apart);
my $score=$record{"resource.$part.$type"};
- $result.='
';
+ $result.='
';
my ($aggtries,$totaltries);
unless (exists($aggregates{$part})) {
$totaltries = $record{'resource.'.$part.'.tries'};
@@ -2786,12 +2790,10 @@ sub editgrades {
for ($i=0; $i<$env{'form.total'}; $i++) {
my $line;
my $user = $env{'form.ctr'.$i};
- my $usercolon = $user;
- $usercolon =~s/_/:/;
- my ($uname,$udom)=split(/_/,$user);
+ my ($uname,$udom)=split(/:/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= '
print("Doing upload to ".$coursedata{'description'}." ");
- my $home=&Apache::lonnet::homeserver($env{'form.courseid'},
- $env{'form.domainid'});
my $fname=$env{'form.upfile.filename'};
#FIXME
#copied from lonnet::userfileupload()
@@ -5159,7 +5198,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 {
@@ -5383,6 +5422,9 @@ GRADINGMENUJS
$result.='