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

banghart lon-capa-cvs@mail.lon-capa.org
Sat, 25 Mar 2006 23:54:10 -0000


banghart		Sat Mar 25 18:54:10 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Saving work in progress. Versioning happening betterly.
  	Useful to actually assign arguments passed to sub.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.340 loncom/homework/grades.pm:1.341
--- loncom/homework/grades.pm:1.340	Fri Mar 24 13:05:47 2006
+++ loncom/homework/grades.pm	Sat Mar 25 18:54:07 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.340 2006/03/24 18:05:47 albertel Exp $
+# $Id: grades.pm,v 1.341 2006/03/25 23:54:07 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2404,11 +2404,12 @@
                         ($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/);
                     my ($answer_name,$answer_ver,$answer_ext) =
 		        &file_name_version_ext($answer_file);
-		    my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stuname,$portfolio_root);
+		    $directory =~ /^.+$stuname\/portfolio(.*)/;
+		    my $portfolio_path = $1;
+		    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, $directory, $answer_file, $version);
+		    my $new_answer = &version_selected_portfile($domain, $stuname, $portfolio_path, $answer_file, $version);
                     $$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer;
-
                     # set the filename to match the submitted file name
                     $env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter};
                     my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'',
@@ -2538,7 +2539,7 @@
 }
 
 sub get_next_version {
-    my ($answer_name, $answer_ext, $dir_list);
+    my ($answer_name, $answer_ext, $dir_list) = @_;
     my $version;
     foreach my $row (@$dir_list) {
         my ($file) = split(/\&/,$row,2);