--- loncom/homework/grades.pm 2006/03/28 18:07:24 1.344
+++ loncom/homework/grades.pm 2006/04/03 20:45:38 1.347
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.344 2006/03/28 18:07:24 albertel Exp $
+# $Id: grades.pm,v 1.347 2006/04/03 20:45:38 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1517,7 +1517,10 @@ sub handback_box {
next if (!@$files);
my $file_counter = 1;
foreach my $file (@$files) {
- my ($file_disp) = ($file =~ m|.+/(.+)$|);
+ my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|);
+ my ($name,$version,$ext) = &file_name_version_ext($file_disp);
+ $file_disp = "$name.$ext";
+ $file = $file_path.$file_disp;
$result.=&mt('Return commented version of [_1] to student.',
''.$file_disp.'');
$result.=''."\n";
@@ -2326,6 +2329,7 @@ sub saveHandGrade {
my $partial= $pts/$wgt;
if ($partial eq $record{'resource.'.$new_part.'.awarded'}) {
#do not update score for part if not changed.
+ &handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord);
next;
} else {
push @parts_graded, $new_part;
@@ -3510,6 +3514,7 @@ sub csvuploadassign {
my ($request)= @_;
my ($symb)=&get_symb($request);
if (!$symb) {return '';}
+ my $error_msg = '';
&Apache::loncommon::load_tmp_file($request);
my @gradedata = &Apache::loncommon::upfile_record_sep();
if ($env{'form.noFirstLine'}) { shift(@gradedata); }
@@ -3562,12 +3567,20 @@ sub csvuploadassign {
my $part=$1;
my $wgt =&Apache::lonnet::EXT('resource.'.$part.'.weight',
$symb,$domain,$username);
- $entries{$fields{$dest}}=~s/\s//g;
- my $pcr=$entries{$fields{$dest}} / $wgt;
- my $award='correct_by_override';
- $grades{"resource.$part.awarded"}=$pcr;
- $grades{"resource.$part.solved"}=$award;
- $points{$part}=1;
+ if ($wgt) {
+ $entries{$fields{$dest}}=~s/\s//g;
+ my $pcr=$entries{$fields{$dest}} / $wgt;
+ my $award='correct_by_override';
+ $grades{"resource.$part.awarded"}=$pcr;
+ $grades{"resource.$part.solved"}=$award;
+ $points{$part}=1;
+ } else {
+ $error_msg = "
" .
+ &mt("Some point values were assigned"
+ ." for problems with a weight "
+ ."of zero. These values were "
+ ."ignored.");
+ }
} else {
if ($dest=~/stores_(.*)_awarded/) { if ($points{$1}) {next;} }
if ($dest=~/stores_(.*)_solved/) { if ($points{$1}) {next;} }
@@ -3607,7 +3620,7 @@ sub csvuploadassign {
}
$request->print("
\n");
$request->print(&show_grading_menu_form($symb));
- return '';
+ return $error_msg;
}
#------------- end of section for handling csv file upload ---------
#