--- loncom/interface/statistics/lonstudentassessment.pm	2003/01/03 23:54:05	1.24
+++ loncom/interface/statistics/lonstudentassessment.pm	2003/01/09 16:37:48	1.26
@@ -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.26 2003/01/09 16:37:48 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -139,7 +139,7 @@ sub BuildStudentAssessmentPage {
             if($Count % 2) {
                 $out .= '<bgcolor="#FFFFFF">';
             } else {
-                $out .= '<bgcolor="#F6F6F6">';
+                $out .= '<bgcolor="#F0F0F0">';
             }
 	    my $displayString = $out.'DISPLAYDATA'.$spacing;
 	    $r->print(&Apache::lonhtmlcommon::FormatStudentInformation(
@@ -173,18 +173,17 @@ sub BuildStudentAssessmentPage {
             untie(%cache);
         }
     }
-
-    if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
-        $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));
-        untie(%cache);
-    }
-    $r->print('</pre>'."\n");
+    $r->print('</pre>'."\n"); 
     if($selected == 0) {
 	$Str .= '<h3><font color=blue>WARNING: ';
-        $Str .= 'Please select a student</font></h3>';
+        $Str .= 'No Students enrolled OR Please select a student</font></h3>';
         $r->print($Str);
+    } else {
+	if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
+	    $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));
+	    untie(%cache);
+	}
     }
-
     return;
 }
 
@@ -425,9 +424,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 .= '<table border=2 cellspacing="1">'."\n";
     $Str .= '<tr><td><b>Students Count</b></td><td><b>'.
             $StudentCount.'</b></td></tr>'."\n";
@@ -446,7 +449,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 .= '<tr><td>'.$title.
                 '</td><td align=center>'.$pCount.
                 '</td><td align=center>'.$crr.