--- loncom/interface/lonstatistics.pm	2002/02/04 16:08:26	1.1
+++ loncom/interface/lonstatistics.pm	2002/02/05 12:24:45	1.2
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.1 2002/02/04 16:08:26 albertel Exp $
+# $Id: lonstatistics.pm,v 1.2 2002/02/05 12:24:45 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,7 +41,6 @@ use strict;
 use Apache::Constants qw(:common :http);
 use Apache::lonnet();
 use Apache::lonhomework;
-use Apache::loncommon();
 use HTML::TokeParser;
 use GDBM_File;
 use Benchmark;
@@ -51,6 +50,7 @@ my %hash;
 my %CachData;
 my %GraphDat;
 my %maps;
+my @mapsort;
 my %section;
 my %StuBox;
 my %DiscFac;
@@ -75,13 +75,15 @@ my $cid;
 my $firstres;
 my $lastres;
 my $DiscFlag=0;
+my $HWN=0;
 
 my %Header = (0,"Problem Title",1,"#Stdnts",2,"Tries",3,"Mod",
               4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"S.D.",
               9,"Skew.",10,"DoDiff",11,"Map");
 #             9,"Skew.",10,"DoDiff",11,"Dis.F.",12,"Resourse URL");
 
-my %class = ();
+my %class = qw(
+);
 
 my @LS;
 my @LF;
@@ -214,6 +216,7 @@ sub Classify {
 #    my %Slvd = &GetUniq(5,"Problems Solved");
 
    # my (@L, $Index,$String)=@_;
+
     my %Time = &GetUniqe(1,"Time",'S');
     &GetUniqe(1,"Time",'F');
     &GetUniqe(2,"Discrimination Factor",'S');    
@@ -371,7 +374,7 @@ sub DiscriminationTable {
                    "\n".'<td>'.$L_Dis.'</td>'.
                    "\n".'<td>'.$UpNo.'</td>'.
                    "\n".'<td>'.$LwNo.'</td>'.
-                   "\n".'<td>'.($DoD).'</td>'.
+                   "\n".'<td>'.$DoD.'</td>'.
                    "\n".'</tr>' );
     } 
     $r->print("\n".'</table>');
@@ -573,9 +576,13 @@ sub PreStatTable {
     '  Mean   : Average Number of the tries. [ Tries / #Stdns ]<br>'.
     '  #YES   : Number of students solved the problem correctly.<br>'. 
     '  #yes   : Number of students solved the problem by override.<br>'.
-    '  %Wrng  : Percentage of students tried to solve the problem but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]<br>'.
-    '  S.D.   : Standard Deviation of the tries.[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1) where Xi is every student\'s tries ]<br>'.
-    '  Skew.  : Skewness of the students tries. [ (sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3) ]<br>'.
+    '  %Wrng  : Percentage of students tried to solve the problem but'.
+    ' still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]<br>'.
+    '  S.D.   : Standard Deviation of the tries.'.
+    '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)'.
+    ' where Xi is every student\'s tries ]<br>'.
+    '  Skew.  : Skewness of the students tries.'.
+    ' [ (sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3) ]<br>'.
 #    '  DoDiff : Degree of Difficulty of the problem. [ Tries/(#YES+#yes+0.1) ]<br>'.
     '  DoDiff : Degree of Difficulty of the problem. [ 1 - ((#YES+#yes) / Tries) ]<br>'.
 #    '  Dis.F. : Discrimination Factor. [ Sum of Partial Credits Awarded / Total Number of Tries in %27 upper and lower students]</b>'.	
@@ -809,6 +816,8 @@ sub tracetable {
 	   my $cmap=$hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}};
            if ( $cmap eq 'sequence' || $cmap eq 'page' ) { 
                $cols[$#cols+1]=0;
+	       $HWN++;
+               $mapsort[$HWN]=$rid.$hash{'title_'.$rid}; 
                #$maps{&Apache::lonnet::declutter($hash{'src_'.$rid})}= 
                #      $hash{'title_'.$rid}; 
            }
@@ -823,6 +832,7 @@ sub tracetable {
                  if ($hash{'src_'.$frid}=~
                                  /\.(problem|exam|quiz|assess|survey|form)$/) {
 		     $cols[$#cols+1]=$frid;
+		     $mapsort[$HWN] .= '&'.$frid;
                  }
 	      }
 	   }
@@ -831,6 +841,7 @@ sub tracetable {
              if ($hash{'src_'.$rid}=~
                                  /\.(problem|exam|quiz|assess|survey|form)$/) {
 	         $cols[$#cols+1]=$rid;
+		 $mapsort[$HWN] .= '&'.$rid;
              }
           }
        }
@@ -1045,7 +1056,7 @@ sub Cache_Statistics {
             $Override,$Wrng,$SD,$Sk,$DoD,$res,$Prob)=split(/\:/,$Post);	
 	$r->print( "\n".'<tr>'.
                "\n".'<td>'.($nIdx+1).'</td>'.
-               "\n".'<td>'.$Temp.'</td>'.
+               "\n".'<td  bgcolor="#FFFFFF">'.$Temp.'</td>'.
                "\n".'<td>'.$StdNo.'</td>'.
                "\n".'<td>'.$TotalTries.'</td>'.
                "\n".'<td>'.$MxTries.'</td>'.
@@ -1160,11 +1171,19 @@ sub ClassList {
 	}
 	else {
 	    $r->print('<h1>Could not access course data</h1>');
-	}
+	} 
         $r->print("Total number of students : ".($#students+1));
         $r->rflush();
 # --------------- Find all assessments and put them into some linear-like order
 	&tracetable($firstres,'&'.$lastres.'&');
+
+#my $c=0;
+#foreach(@mapsort) {
+#    $c++;
+#    $r->print('<br>'.$mapsort[$c]);
+#}
+#$r->print('<br> Count = '.$c);
+
     }
 
 # ------------------------------------------------------------- End render page 
@@ -1329,7 +1348,6 @@ sub handler {
 	    else {
 		$r->content_type('text/html');
 	    }
-	    &Apache::loncommon::no_cache($r);
 	    $r->send_http_header;
 	    return OK;
 	}