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

minaeibi lon-capa-cvs@mail.lon-capa.org
Mon, 29 Jul 2002 22:01:12 -0000


minaeibi		Mon Jul 29 18:01:12 2002 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemstatistics.pm 
  Log:
  Found a bug in loading discrimination factor.
  It needs more work to fix.
  
  
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.5 loncom/interface/statistics/lonproblemstatistics.pm:1.6
--- loncom/interface/statistics/lonproblemstatistics.pm:1.5	Mon Jul 29 17:23:22 2002
+++ loncom/interface/statistics/lonproblemstatistics.pm	Mon Jul 29 18:01:11 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonproblemstatistics.pm,v 1.5 2002/07/29 21:23:22 minaeibi Exp $
+# $Id: lonproblemstatistics.pm,v 1.6 2002/07/29 22:01:11 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,5/26,7/16,7/25  Behrouz Minaei
+# 5/12,5/14,5/15,5/19,5/26,7/16,7/25,7/29  Behrouz Minaei
 #
 ###
 
@@ -80,24 +80,23 @@
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
         return '<html><body>Unable to tie database.</body></html>';
     }
-    my $discriminantFactor;
+    my %discriminant=();
     my @list=();
     my %Discuss=&Apache::loncoursedata::LoadDiscussion($courseID);
     my $index=0;
     foreach (@$students) {
 	$index++;
 	#&Apache::lonstatistics::Update_PrgWin(++$index,$r);
-        $discriminantFactor = &ExtractStudentData(\%cache, $_, \@list,
-						  \%Discuss, $r);
+        &ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, \%discriminant);
     }
     #&Apache::lonstatistics::Close_PrgWin($r);
  
-    my ($upper, $lower) = &Discriminant($discriminantFactor);
+    my ($upper, $lower) = &Discriminant(\%discriminant);
     my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod",
                   4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff",
                   9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd", 13, "Disc.");
     my $color=&setbgcolor(0);
-    my %GraphDat= &BuildStatisticsTable(\%cache, $discriminantFactor, \@list, 
+    my %GraphDat= &BuildStatisticsTable(\%cache, \%discriminant, \@list, 
                                         \%Header, $students, $r, $color);
     untie(%cache);
 }
@@ -146,9 +145,7 @@
  
 # ------ Dump the Student's DB file and handling the data for statistics table 
 sub ExtractStudentData {
-    my ($cache,$name,$list,$Discuss,$r)=@_;
-    my %discriminantFactor;
-
+    my ($cache,$name,$list,$Discuss,$r,$discriminant)=@_;
     my $totalTries = 0;
     my $totalAwarded = 0;
     my $spent=0;
@@ -296,7 +293,7 @@
                     $Discussed=1;
                 }
                 my $time = $cache->{"$name:$LatestVersion:$problem:timestamp"};
-                $Dis .= $tempProblemOrder.'='.$DisF.'+'.$Yes;
+                $Dis .= $tempSequenceOrder.'@'.$pOrder.'='.$DisF.'+'.$Yes;
                 $ptr .= '&'.$partData{$_.':tries'}.
                         '&'.$partData{$_.':wrong'}.
                         '&'.$partData{$_.':code'};
@@ -336,11 +333,9 @@
 	    $pstr=$DisFactor.':'.$name.':'.$ProbTot.':'.$TotalOpend.':'.
                   $totalTries.':'.$ProbSolved.':'.$TotFirst.':'.
                   $TS_yes.':'.$TS.':'.$TotDiscuss;
-	    $discriminantFactor{$pstr}=$Dis;
+	    (%$discriminant)->{$pstr}=$Dis;
 	}
     }
-
-    return (\%discriminantFactor);
 }
 
 
@@ -364,11 +359,6 @@
     my $NoElements = scalar @$list;
     my @List=sort(@$list);
 
-#    for (my $c=0;$c<$NoElements;$c++) {
-##	$r->print('<br>'.$c.')'.$List[$c]);
-#	$r->print("<br>$List[$c]");
-#    }
-
 #6666666
 #    my $file="/home/httpd/perl/tmp/183d.txt";
 #    open(OUT, ">$file");
@@ -427,15 +417,8 @@
 		($tar,$Tries,$Wrongs,$Code,$Disc)=split(/\&/,
                                                      $List[$cIdx]);
 	        ($SqOrd,$PrOrd,$Prob)=split(/\:/,$tar);
-
-#$r->print("<br>$cIdx ... $SqOrd, $PrOrd, $Tries, $Wrongs, $Code, $Disc");
-#$r->rflush();
-
 	    }
 
-#$r->print("<br>$cIdx ... $SqOrd  , $Temp , $TotalTries");
-#$r->rflush();
-
 	    $p_count++;
 	    my $Dummy;
 	    ($ResId,$Dummy)=split(/\*/,$Temp);
@@ -736,42 +719,42 @@
     my $Ptr = '';
     $Ptr = '<table border="0">';
     $Ptr .= '<tr><td>';
-    $Ptr .= '<b>#Stdnts</b>:</td>';
+    $Ptr .= '<b>#Stdnts</b></td>';
     $Ptr .= '<td>Total Number of Students opened the problem.';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>Tries</b>:</td>';
+    $Ptr .= '<b>Tries</b></td>';
     $Ptr .= '<td>Total Number of Tries for solving the problem.';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>Mod</b>:</td>';
+    $Ptr .= '<b>Mod</b></td>';
     $Ptr .= '<td>Maximunm Number of Tries for solving the problem.';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>Mean</b>:</td>';
+    $Ptr .= '<b>Mean</b></td>';
     $Ptr .= '<td>Average Number of the tries. [ Tries / #Stdnts ]';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>#YES</b>:</td>';
+    $Ptr .= '<b>#YES</b></td>';
     $Ptr .= '<td>Number of students solved the problem correctly.';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>#yes</b>:</td>';
+    $Ptr .= '<b>#yes</b></td>';
     $Ptr .= '<td>Number of students solved the problem by override.';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>%Wrng</b>:</td>';
+    $Ptr .= '<b>%Wrng</b></td>';
     $Ptr .= '<td>Percentage of students tried to solve the problem ';
     $Ptr .= 'but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>DoDiff</b>:</td>';
+    $Ptr .= '<b>DoDiff</b></td>';
     $Ptr .= '<td>Degree of Difficulty of the problem.  ';
     $Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>S.D.</b>:</td>';
+    $Ptr .= '<b>S.D.</b></td>';
     $Ptr .= '<td>Standard Deviation of the tries.  ';
     $Ptr .= '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1) ';
     $Ptr .= 'where Xi denotes every student\'s tries ]';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>Skew.</b>:</td>';
+    $Ptr .= '<b>Skew.</b></td>';
     $Ptr .= '<td>Skewness of the students tries.';
     $Ptr .= '[(sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3)]';
     $Ptr .= '</td></tr><tr><td>';
-    $Ptr .= '<b>Dis.F.</b>:</td>';
+    $Ptr .= '<b>Dis.F.</b></td>';
     $Ptr .= '<td>Discrimination Factor: A Standard for evaluating the ';
     $Ptr .= 'problem according to a Criterion<br>';
     $Ptr .= '<b>[Applied Criterion in %27 Upper Students - ';