[LON-CAPA-cvs] cvs: loncom /homework grades.pm

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 21 Jun 2006 20:18:44 -0000


banghart		Wed Jun 21 16:18:44 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Bug 4817. Don't create extra versions of handback files.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.363 loncom/homework/grades.pm:1.364
--- loncom/homework/grades.pm:1.363	Mon Jun 12 18:14:29 2006
+++ loncom/homework/grades.pm	Wed Jun 21 16:18:43 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.363 2006/06/12 22:14:29 albertel Exp $
+# $Id: grades.pm,v 1.364 2006/06/21 20:18:43 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2330,7 +2330,7 @@
 		if (exists($record{'resource.'.$new_part.'.awarded'})) {
 		    $newrecord{'resource.'.$new_part.'.awarded'} = '';
 		}
-	    $newrecord{'resource.'.$new_part.'.regrader'}="$env{'user.name'}:$env{'user.domain'}";
+	        $newrecord{'resource.'.$new_part.'.regrader'}="$env{'user.name'}:$env{'user.domain'}";
 	    }
 	} elsif ($dropMenu eq 'reset status'
 		 && exists($record{'resource.'.$new_part.'.solved'})) { #don't bother if no old records -> no attempts
@@ -2405,7 +2405,8 @@
 
     if (%newrecord) {
         if (@version_parts) {
-            my @changed_keys = &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts);
+            my @changed_keys = &version_portfiles(\%record, \@parts_graded, 
+                                $env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts);
 	    @newrecord{@changed_keys} = @record{@changed_keys};
         }
 	&Apache::lonnet::cstore(\%newrecord,$symb,
@@ -2447,9 +2448,6 @@
 		    my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/);
 		    my @dir_list = &Apache::lonnet::dirlist($portfolio_path,$domain,$stuname,$portfolio_root);
 		    my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
-		    my $new_answer = &version_selected_portfile($domain, $stuname, $portfolio_path, $answer_file, $version);
-                    $$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer;
-                    $version++;
                     # fix file name
                     my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/);
                     my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain,
@@ -2463,12 +2461,12 @@
                         my @files = ($save_file_name);
                         my @what = ($symb,'handback');
                         &Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what);
+                        $$newrecord{"resource.$new_part.$resp_id.handback"} = $save_file_name;
                         my $subject = "File Handed Back by Instructor ";
                         my $message = "A file has been returned that was originally submitted in reponse to: <br />";
                         $message .= "<strong>".&Apache::lonnet::gettitle($symb)."</strong><br />";
                         $message .= " The returned file is named: <br /><strong>".$save_file_name."</strong><br />";
                         $message .= " and can be found in your portfolio space.";
-                        &Apache::lonnet::logthis($message);
 			my $url = (&Apache::lonnet::decode_symb($symb))[2];
 			$url = &Apache::lonnet::declutter($url);
                         my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain,