--- loncom/interface/statistics/lonstudentassessment.pm 2004/01/27 19:50:03 1.82 +++ loncom/interface/statistics/lonstudentassessment.pm 2004/02/10 16:47:25 1.84 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.82 2004/01/27 19:50:03 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.84 2004/02/10 16:47:25 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1016,7 +1016,12 @@ END # Put the names of the problems and parts into the sheet my $count = 0; 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, @@ -1035,11 +1040,16 @@ END $seq->{'Excel:endcell'} = $seq->{'Excel:startcell'}; $seq->{'Excel:endcol'} = $seq->{'Excel:startcol'}; } else { - &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell - ($rows_output,$cols_output-1); + $seq->{'Excel:endcell'} = + &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell + ($rows_output,$cols_output-1); $seq->{'Excel:endcol'} = $cols_output-1; } # Create the formula for summing up this sequence + if (! exists($seq->{'Excel:endcell'}) || + ! defined($seq->{'Excel:endcell'})) { + $seq->{'Excel:endcell'} = $seq->{'Excel:startcell'}; + } $seq->{'Excel:sum'}= $excel_sheet->store_formula ('=SUM('.$seq->{'Excel:startcell'}. ':'.$seq->{'Excel:endcell'}.')');