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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Sun, 22 Jan 2006 21:12:00 -0000


bowersj2		Sun Jan 22 16:12:00 2006 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  Towards fixing bug 4508: Instead of just putting in a 
  SUM(start:end) 
  for the Total column, put in 
  IF(COUNT(start:end),SUM(start:end),"")
  
  This will sum the scores up if there are any scores, but put a blank
  string into the sum if there were no attempts at all. If the professor
  then averages that column, this will much more closely match the
  LON-CAPA-claimed average for the sequence.
  
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.126 loncom/interface/statistics/lonstudentassessment.pm:1.127
--- loncom/interface/statistics/lonstudentassessment.pm:1.126	Sat Jan 21 21:10:03 2006
+++ loncom/interface/statistics/lonstudentassessment.pm	Sun Jan 22 16:11:59 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.126 2006/01/22 02:10:03 bowersj2 Exp $
+# $Id: lonstudentassessment.pm,v 1.127 2006/01/22 21:11:59 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1144,9 +1144,11 @@
             ! defined($formula_data{$symb}->{'Excel:endcell'})) {
             $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'};
         }
+        # =IF(COUNT(B31:L31);SUM(B31:L31);"")
+        my $start = $formula_data{$symb}->{'Excel:startcell'};
+        my $end = $formula_data{$symb}->{'Excel:endcell'};
         $formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula
-            ('=SUM('.$formula_data{$symb}->{'Excel:startcell'}.
-             ':'.$formula_data{$symb}->{'Excel:endcell'}.')');
+            ("=IF(COUNT($start\:$end),SUM($start\:$end),\"\")");
         # Determine cell the score is held in
         $formula_data{$symb}->{'Excel:scorecell'} = 
             &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell
@@ -1255,7 +1257,7 @@
 		     &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'}));
                 $excel_sheet->repeat_formula($maximum_data_row,$cols_output++,
                                              $formula_data{$symb}->{'Excel:sum'},undef,
-					     %replaceCells);
+					     %replaceCells, %replaceCells);
 			
             } elsif ($chosen_output->{'sequence_sum'}) {
                 $excel_sheet->write($maximum_data_row,$cols_output++,$max);
@@ -1439,7 +1441,7 @@
             # The undef is for the format	    
 	    $excel_sheet->repeat_formula($rows_output,$cols_output++,
 					 $formula_data{$symb}->{'Excel:sum'},undef,
-					 %replaceCells);
+					 %replaceCells, %replaceCells);
         } elsif ($chosen_output->{'sequence_sum'}) {
             if ($score eq ' ') {
                 $cols_output++;