--- loncom/interface/statistics/lonstudentassessment.pm 2006/01/22 02:10:03 1.126 +++ loncom/interface/statistics/lonstudentassessment.pm 2006/01/22 21:11:59 1.127 @@ -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 @@ sub excel_initialize { ! 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 @@ sub excel_initialize { &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 @@ sub excel_outputstudent { # 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++;