[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm

minaeibi lon-capa-cvs@mail.lon-capa.org
Mon, 27 May 2002 00:24:05 -0000


minaeibi		Sun May 26 20:24:05 2002 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
  Log:
  Fixed some bugs in the inteface
  Started worked on Activity Log
  
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.20 loncom/interface/lonstatistics.pm:1.21
--- loncom/interface/lonstatistics.pm:1.20	Sun May 19 11:44:40 2002
+++ loncom/interface/lonstatistics.pm	Sun May 26 20:24:05 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.20 2002/05/19 15:44:40 minaeibi Exp $
+# $Id: lonstatistics.pm,v 1.21 2002/05/27 00:24:05 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,7 +31,7 @@
 # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002
 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
-# 5/12,5/14,5/15,5/19 Behrouz Minaei
+# 5/12,5/14,5/15,5/19,5/26 Behrouz Minaei
 #
 ###
 
@@ -86,6 +86,51 @@
               9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd");
 my %Answer = ();
 
+
+sub unescape {
+    my $str=shift;
+    $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
+    return $str;
+}
+
+sub Activity {
+    my $file="/home/minaeibi/minaei";
+    my $userid='billskat';
+    $r->print("<br>Using $file");
+    $r->rflush();
+    open(FILEID, "<$file");
+    my $line;
+    my @allaccess;
+    while ($line=<FILEID>) {
+	my ($time,$machine,$what)=split(':',$line);
+	#$r->print("time=$time machine=$machine:-> $what\n");
+	#$r->rflush();
+	$what=&unescape($what);
+	my @accesses=split('&',$what);
+	foreach my $access (@accesses) {
+	    my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
+	    if ($who ne $userid) { next; }
+	    #if (!$resource) { next; }
+	    push (@allaccess,unescape($access));
+	    #print $machine;
+	}
+    }
+    @allaccess=sort(@allaccess);
+    my $Count=0;
+    foreach my $access (@allaccess) {
+	my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
+	$Count++;
+#	$r->print("$Count ".localtime($date)." $who $resource\n");
+	$r->print("<br>$Count) $date: $who --> $resource");
+	$r->rflush();
+	if ($post) { 
+	    $r->print("<br><b>Sent data ".join(':',unescape(@posts)).'</b>');
+	}
+    }
+}
+
+
+
 sub InitAnalysis {
     my ($rid, $student)=@_;
     my ($uname,$udom)=split(/\:/,$student);
@@ -279,7 +324,7 @@
     my $OpSel='';
     my $CurInt = $ENV{'form.interval'};
     if ($CurInt eq '') {$CurMap = '1';}
-    my $Ptr = '<b>Select number of intervals</b>'."\n".
+    my $Ptr = '<br><b>Select number of intervals</b>'."\n".
        	      '<select name="interval">'."\n";                     	     	     
     for (my $n=1;$n<=7;$n++) {	          
 	$Ptr .= '<option';
@@ -295,7 +340,7 @@
               "\n".'<tr>'.
               "\n".'<th> # </th>'.
 	      "\n".'<th> Problem Title </th>'.
-	      "\n".'<th> Resouse </th>'.
+	      "\n".'<th> Resource </th>'.
 	      "\n".'<th> Address </th>'.
 	      "\n".'</tr>';
 
@@ -639,8 +684,8 @@
     $Ptr .= '<pre>'.
     '<b>  #Stdnts</b>: Total Number of Students opened the problem.<br>'. 
     '<b>  Tries  </b>: Total Number of Tries for solving the problem.<br>'. 
-    '<b>  Max   </b> : Maximunm Number of Tries for solving the problem.<br>'. 
-    '<b>  Avg.   </b>: Average Number of the tries. [ Tries / #Stdnts ]<br>'.
+    '<b>  Mod    </b>: Maximunm Number of Tries for solving the problem.<br>'. 
+    '<b>  Mean   </b>: Average Number of the tries. [ Tries / #Stdnts ]<br>'.
     '<b>  #YES   </b>: Number of students solved the problem correctly.<br>'. 
     '<b>  #yes   </b>: Number of students solved the problem by override.<br>'.
     '<b>  %Wrng  </b>: Percentage of students tried to solve the problem but'.
@@ -648,10 +693,10 @@
 #    '  DoDiff : Degree of Difficulty of the problem. [ Tries/(#YES+#yes+0.1) ]<br>'. Kashy formula
     '<b>  DoDiff </b>: Degree of Difficulty of the problem. [ 1 - ((#YES+#yes) / Tries) ]<br>'. #Gerd formula
     '<b>  S.D.  </b> : Standard Deviation of the tries.'.
-    '[ sqrt(sum((Xi - Avg.)^2)) / (#Stdnts-1)'.
+    '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)'.
     ' where Xi denotes every student\'s tries ]<br>'.
     '<b>  Skew.  </b>: Skewness of the students tries.'.
-	' [ (sqrt( sum((Xi - Avg.)^3) / #Stdnts)) / (S.D.^3) ]<br>'.
+	' [ (sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3) ]<br>'.
     '<b>  Dis.F. </b>: Discrimination Factor: A Standard for '.
 	'evaluating the problem according to a Criterion<br>'.
 	'<b>           [Applied Criterion in %27 Upper Students - '.
@@ -882,6 +927,7 @@
 }
 
 
+
 # ------------------------------------------------------------ Build page table
 sub tracetable {
     my ($rid,$beenhere)=@_;
@@ -1460,6 +1506,8 @@
 	$Ptr .= '<br><br>';
 	$Ptr .= '<input type=submit name=sort value="Student Assessment"/>';
 	$Ptr .= '</h3>';
+	#$Ptr .= '<input type=submit name=sort value="Activity Log"/>';
+	#$Ptr .= '</h3>';
 	$r->print( $Ptr );
     }
     else {
@@ -1488,7 +1536,10 @@
 #    $Apache::lonxml::debug=0;
     &Title();
     my $InpStr = $ENV{'form.sort'};
-    if ($InpStr=~/^Analyze\_/) {
+    if ($InpStr eq 'Activity Log') {
+	&Activity();
+    }    
+    elsif ($InpStr=~/^Analyze\_/) {
 	&ClassList();
 	&ShowOpGraph($InpStr,$ENV{'form.interval'});
     }
@@ -1504,6 +1555,7 @@
 	      "\n".'</html>');
     $r->rflush();
 }
+
 
 sub StudentOptions {
     my $OpSel5='';