--- loncom/homework/grades.pm 2005/07/12 14:57:55 1.276
+++ 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.276 2005/07/12 14:57:55 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='';
@@ -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 =~ /^(.*?)([^\/]*$)/);
@@ -2655,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"};
@@ -2785,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 .= '