--- loncom/interface/statistics/lonstudentassessment.pm 2003/01/03 23:54:05 1.24 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/01/09 15:59:17 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstudentassessment.pm,v 1.24 2003/01/03 23:54:05 minaeibi Exp $ +# $Id: lonstudentassessment.pm,v 1.25 2003/01/09 15:59:17 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -425,9 +425,13 @@ sub StudentAverageTotal { $ProblemsSolved += $cache->{$name.':problemsSolved'}; $TotalProblems += $cache->{$name.':totalProblems'}; } - $ProblemsSolved /= $StudentCount; - $TotalProblems /= $StudentCount; - + if ($StudentCount) { + $ProblemsSolved /= $StudentCount; + $TotalProblems /= $StudentCount; + } else { + $ProblemsSolved = 0; + $TotalProblems = 0; + } $Str .= ''."\n"; $Str .= ''."\n"; @@ -446,7 +450,12 @@ sub StudentAverageTotal { #my @problems=split(':', $cache->{$S.':problems'}); #my $pCount=scalar @problems; my $pCount=MaxSeqPr($cache,@$students[0],$S); - my $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount ); + my $crr; + if ($StudentCount) { + $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount ); + } else { + $crr="0.00"; + } $Str .= '
Students Count'. $StudentCount.'
'.$title. ''.$pCount. ''.$crr.