--- loncom/interface/statistics/lonstudentassessment.pm 2004/01/27 16:04:27 1.80 +++ loncom/interface/statistics/lonstudentassessment.pm 2004/02/10 19:08:02 1.81.2.1 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.80 2004/01/27 16:04:27 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.81.2.1 2004/02/10 19:08:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1017,7 +1017,12 @@ END $seq->{'Excel:startcol'}=$cols_output; # Put the names of the problems and parts into the sheet foreach my $res (@{$seq->{'contents'}}) { - next if ($res->{'type'} ne 'assessment'); + if ($res->{'type'} ne 'assessment' || + ! exists($res->{'parts'}) || + ref($res->{'parts'}) ne 'ARRAY' || + scalar(@{$res->{'parts'}}) < 1) { + next; + } if (scalar(@{$res->{'parts'}}) > 1) { foreach my $part (@{$res->{'parts'}}) { $excel_sheet->write($rows_output, @@ -1207,9 +1212,15 @@ sub excel_outputstudent { &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); + 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); + } # $excel_sheet->write($rows_output,$cols_output++,$seq_max); } elsif ($data eq 'sum and total' || $data eq 'sum only' ||