[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstudentassessment.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 21 Jan 2005 18:52:40 -0000


albertel		Fri Jan 21 13:52:40 2005 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  - Excel Forumlas were not being rewritten properly
     For example if you have a formula of =SUM(H11:H11), for row 110 this was turning into
      =SUM(H1100:H11)
  
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.109 loncom/interface/statistics/lonstudentassessment.pm:1.110
--- loncom/interface/statistics/lonstudentassessment.pm:1.109	Fri Jan 14 16:15:09 2005
+++ loncom/interface/statistics/lonstudentassessment.pm	Fri Jan 21 13:52:40 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.109 2005/01/14 21:15:09 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.110 2005/01/21 18:52:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -358,7 +358,7 @@
         &mt('Clear Caches').'" />';
     $Str .= ' 'x5;
     $Str .= 
-        &mt('Status [_1]',
+        &mt('Status[_1]',
             '<input type="text" name="stats_status" size="60" value="" />');
     $Str .= '<br />';
     return $Str;
@@ -1204,16 +1204,15 @@
             #
             if ($chosen_output->{'sequence_sum'} && 
                 $chosen_output->{'every_problem'}) {
-                my %replaceCells;
-                $replaceCells{$seq->{'Excel:startcell'}} = 
-                    &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
-                    ($maximum_data_row,$seq->{'Excel:startcol'});
-                $replaceCells{$seq->{'Excel:endcell'}} = 
-                    &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
-                    ($maximum_data_row,$seq->{'Excel:endcol'});
+		my %replaceCells=
+		    ('^'.$seq->{'Excel:startcell'}.':'.
+		         $seq->{'Excel:endcell'}.'$' =>
+		     &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$seq->{'Excel:startcol'}).':'.
+		     &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$seq->{'Excel:endcol'}));
                 $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
                                              $seq->{'Excel:sum'},undef,
-                                             %replaceCells);
+					     %replaceCells);
+			
             } elsif ($chosen_output->{'sequence_sum'}) {
                 $excel_sheet->write($maximum_data_row,$cols_output++,$max);
             }
@@ -1383,23 +1382,16 @@
         if ($chosen_output->{'sequence_sum'} && 
             $chosen_output->{'every_problem'}) {
             # Write a formula for the sum of this sequence
-            my %replaceCells;
-            $replaceCells{$seq->{'Excel:startcell'}} = 
-                &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
-                            ($rows_output,$seq->{'Excel:startcol'});
-            $replaceCells{$seq->{'Excel:endcell'}} = 
-                &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
-                            ($rows_output,$seq->{'Excel:endcol'});
-            # The undef is for the format
-            if (scalar(keys(%replaceCells)) == 1) {
-                $excel_sheet->repeat_formula($rows_output,$cols_output++,
-                                             $seq->{'Excel:sum'},undef,
-                                             %replaceCells,%replaceCells);
-            } else {
-                $excel_sheet->repeat_formula($rows_output,$cols_output++,
-                                             $seq->{'Excel:sum'},undef,
-                                             %replaceCells);
-            }
+            my %replaceCells=
+		('^'.$seq->{'Excel:startcell'}.':'.$seq->{'Excel:endcell'}.'$'
+		 => 
+		 &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$seq->{'Excel:startcol'}).':'.
+		 &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$seq->{'Excel:endcol'})
+		 );
+            # The undef is for the format	    
+	    $excel_sheet->repeat_formula($rows_output,$cols_output++,
+					 $seq->{'Excel:sum'},undef,
+					 %replaceCells);
         } elsif ($chosen_output->{'sequence_sum'}) {
             if ($score eq ' ') {
                 $cols_output++;