version 1.1, 2002/07/24 14:52:32
|
version 1.2, 2002/07/25 19:29:23
|
Line 31
|
Line 31
|
# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei |
# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei |
# YEAR=2002 |
# 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 |
# 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 Behrouz Minaei |
# 5/12,5/14,5/15,5/19,5/26,7/16,7/25 Behrouz Minaei |
# |
# |
### |
### |
|
|
Line 43 use Apache::lonhtmlcommon;
|
Line 43 use Apache::lonhtmlcommon;
|
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use GDBM_File; |
use GDBM_File; |
|
|
my $r; |
|
my %DoDiff; |
|
my %Discuss; |
|
my %mapsort; |
my %mapsort; |
my %hash; |
|
my %CachData; |
|
my %color; |
|
my %GraphDat; |
|
|
|
sub BuildProblemStatisticsPage { |
sub BuildProblemStatisticsPage { |
my ($cacheDB, $students, $courseID, $c, $jr)=@_; |
my ($cacheDB, $students, $courseID, $c, $r,%color)=@_; |
|
|
$r = $jr; |
|
my %cache; |
my %cache; |
|
#my %DoDiff; |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { |
return '<html><body>Unable to tie database.</body></html>'; |
return '<html><body>Unable to tie database.</body></html>'; |
} |
} |
Line 69 sub BuildProblemStatisticsPage {
|
Line 61 sub BuildProblemStatisticsPage {
|
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= &AscendOrderOptions($cache{'Ascend'}); |
$Ptr .= &AscendOrderOptions($cache{'Ascend'}); |
$Ptr .= &ProblemStatisticsButtons($cache{'DisplayFormat'}); |
$Ptr .= &ProblemStatisticsButtons($cache{'DisplayFormat'}); |
$Ptr .= '</table>'; |
$Ptr .= '</table>'; |
|
|
$Ptr .= &ProblemStatisticsLegend(); |
$Ptr .= &ProblemStatisticsLegend(); |
|
|
Line 91 sub BuildProblemStatisticsPage {
|
Line 83 sub BuildProblemStatisticsPage {
|
} |
} |
my $discriminantFactor; |
my $discriminantFactor; |
my @list=(); |
my @list=(); |
|
my %Discuss=&Apache::loncoursedata::LoadDiscussion($courseID); |
|
my $index=0; |
foreach (@$students) { |
foreach (@$students) { |
$discriminantFactor = &ExtractStudentData(\%cache, $_, \@list); |
#&Apache::lonstatistics::Update_PrgWin(++$index,$r); |
|
$discriminantFactor = &ExtractStudentData(\%cache, $_, \@list,\%Discuss); |
} |
} |
|
#&Apache::lonstatistics::Close_PrgWin($r); |
|
|
return $Ptr; |
return $Ptr; |
my ($upper, $lower) = &Discriminant($discriminantFactor); |
my ($upper, $lower) = &Discriminant($discriminantFactor); |
my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", |
my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", |
4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", |
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."); |
9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd", 13, "Disc."); |
&Apache::loncoursedata::LoadDiscussion($courseID, $courseID, \%Discuss); |
|
&BuildStatisticsTable(\%cache, $discriminantFactor, \@list, \%Header, |
my %GraphDat= &BuildStatisticsTable(\%cache, $discriminantFactor, \@list, |
$students); |
\%Header, $students, $r, \%color); |
|
|
untie(%cache); |
untie(%cache); |
|
|
Line 109 sub BuildProblemStatisticsPage {
|
Line 106 sub BuildProblemStatisticsPage {
|
} |
} |
|
|
sub BuildDiffGraph { |
sub BuildDiffGraph { |
my ($courseID)=@_; |
my ($r)=@_; |
|
|
my $graphData = &GetGraphData('DiffGraph', $courseID); |
my $graphData = &GetGraphData('DiffGraph', $r); |
return '<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'; |
return '<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'; |
} |
} |
|
|
sub BuildWrongGraph { |
sub BuildWrongGraph { |
my ($courseID)=@_; |
my ($r)=@_; |
|
|
my $graphData = &GetGraphData('WrongGraph', $courseID); |
my $graphData = &GetGraphData('WrongGraph', $r); |
return '<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'; |
return '<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'; |
} |
} |
|
|
Line 272 sub Build_log {
|
Line 269 sub Build_log {
|
} |
} |
|
|
sub Activity { |
sub Activity { |
# $rid=~/(\d+)\.(\d+)/; |
|
# my $MapId=$1; |
|
# my $PrbId=$2; |
|
# my $MapOrg = $hash{'map_id_'.$MapId}; |
|
# my $Map = &Apache::lonnet::declutter($MapOrg); |
|
# my $URI = $hash{'src_'.$rid}; |
|
# my $Symb = $Map.'___'.$PrbId.'___'.&Apache::lonnet::declutter($URI); |
|
my $file="/home/minaeibi/activity.log"; |
my $file="/home/minaeibi/activity.log"; |
my $userid='adamsde1'; |
my $userid='adamsde1'; |
$r->print("<br>Using $file"); |
# $r->print("<br>Using $file"); |
$r->rflush(); |
# $r->rflush(); |
open(FILEID, "<$file"); |
open(FILEID, "<$file"); |
my $line; |
my $line; |
my @allaccess; |
my @allaccess; |
Line 298 sub Activity {
|
Line 288 sub Activity {
|
my $res=&Apache::lonnet::unescape($resource); |
my $res=&Apache::lonnet::unescape($resource); |
if (($res =~ /\.(sequence|problem|htm|html|page)/)) { |
if (($res =~ /\.(sequence|problem|htm|html|page)/)) { |
$Count++; |
$Count++; |
$r->print("<br>$Count) ".localtime($date).": $who --> $res"); |
###888 $r->print("<br>$Count) ".localtime($date).": $who --> $res"); |
# if ($post) { |
# if ($post) { |
# $Count++; |
# $Count++; |
# $r->print("<br><b>$Count) Sent data ".join(':', |
# $r->print("<br><b>$Count) Sent data ".join(':', |
# &Apache::lonnet::unescape(@posts)).'</b>'); |
# &Apache::lonnet::unescape(@posts)).'</b>'); |
# } |
# } |
$r->rflush(); |
###888 $r->rflush(); |
} |
} |
#push (@allaccess,unescape($access)); |
#push (@allaccess,unescape($access)); |
#print $machine; |
#print $machine; |
Line 403 sub NumericSort {
|
Line 393 sub NumericSort {
|
|
|
|
|
sub CreateProblemStatisticsTableHeading { |
sub CreateProblemStatisticsTableHeading { |
my ($displayFormat,$sequenceSource,$sequenceTitle,$headings)=@_; |
my ($displayFormat,$sequenceSource,$sequenceTitle,$headings,$r)=@_; |
if($displayFormat eq 'Display CSV Format') { |
if($displayFormat eq 'Display CSV Format') { |
$r->print('<br>"'.$sequenceTitle.'","'); |
$r->print('<br>"'.$sequenceTitle.'","'); |
$r->print($sequenceSource.'"'); |
$r->print($sequenceSource.'"'); |
Line 425 sub CreateProblemStatisticsTableHeading
|
Line 415 sub CreateProblemStatisticsTableHeading
|
} |
} |
|
|
sub CloseTable { |
sub CloseTable { |
my ($cache)=@_; |
my ($cache,$r)=@_; |
if($cache->{'DisplayFormat'} eq 'Display CSV Format') { |
if($cache->{'DisplayFormat'} eq 'Display CSV Format') { |
return; |
return; |
} |
} |
Line 437 sub CloseTable {
|
Line 427 sub CloseTable {
|
|
|
# ------ Dump the Student's DB file and handling the data for statistics table |
# ------ Dump the Student's DB file and handling the data for statistics table |
sub ExtractStudentData { |
sub ExtractStudentData { |
my ($cache,$name,$list)=@_; |
my ($cache,$name,$list,%Discuss)=@_; |
my %discriminantFactor; |
my %discriminantFactor; |
|
|
my $totalTries = 0; |
my $totalTries = 0; |
Line 544 sub ExtractStudentData {
|
Line 534 sub ExtractStudentData {
|
$partData{$_.':code'} eq 'O') { |
$partData{$_.':code'} eq 'O') { |
$Yes=1; |
$Yes=1; |
} |
} |
#my $ptr = "$hash{'title_'.$ResId}"; |
|
my $ptr = $tempProblemOrder.'&'.$problemID; |
my $ptr = $tempProblemOrder.'&'.$problemID; |
|
|
if($_ > 1) { |
if($_ > 1) { |
Line 631 sub MySort {
|
Line 620 sub MySort {
|
=cut |
=cut |
|
|
sub BuildStatisticsTable { |
sub BuildStatisticsTable { |
my ($cache,$discriminantFactor,$list,$headings,$students)=@_; |
my ($cache,$discriminantFactor,$list,$headings,$students,$r,%color)=@_; |
|
|
#6666666 |
#6666666 |
# my $file="/home/httpd/perl/tmp/183d.txt"; |
# my $file="/home/httpd/perl/tmp/183d.txt"; |
# open(OUT, ">$file"); |
# open(OUT, ">$file"); |
#6666666 |
#6666666 |
&Create_PrgWin(); |
## &Apache::lonstatistics::Create_PrgWin($r); |
##777777 |
##777777 |
## my (%Activity) = &LoadActivityLog(); |
## my (%Activity) = &LoadActivityLog(); |
## $r->print('<script>popwin.document.popremain.remaining.value="'. |
## $r->print('<script>popwin.document.popremain.remaining.value="'. |
Line 649 sub BuildStatisticsTable {
|
Line 638 sub BuildStatisticsTable {
|
my $dummy; |
my $dummy; |
my $p_val; |
my $p_val; |
my $ResId; |
my $ResId; |
|
my %GraphDat; |
my $NoElements = scalar @$list; |
my $NoElements = scalar @$list; |
|
|
foreach my $sequence (split(':', $cache->{'orderedSequences'})) { |
foreach my $sequence (split(':', $cache->{'orderedSequences'})) { |
Line 660 sub BuildStatisticsTable {
|
Line 650 sub BuildStatisticsTable {
|
&CreateProblemStatisticsTableHeading($cache->{'DisplayFormat'}, |
&CreateProblemStatisticsTableHeading($cache->{'DisplayFormat'}, |
$cache->{$sequence.':source'}, |
$cache->{$sequence.':source'}, |
$cache->{$sequence.':title'}, |
$cache->{$sequence.':title'}, |
$headings); |
$headings,$r); |
|
|
##777777 |
##777777 |
## $Str .= &Classify($discriminantFactor, $students); |
## $Str .= &Classify($discriminantFactor, $students); |
Line 698 sub BuildStatisticsTable {
|
Line 688 sub BuildStatisticsTable {
|
my $Dummy; |
my $Dummy; |
($ResId,$Dummy)=split(/\*/,$Temp); |
($ResId,$Dummy)=split(/\*/,$Temp); |
|
|
$Temp = '<a href="'.$hash{'src_'.$ResId}. |
$Temp = '<a href="'.$cache->{'src_'.$ResId}. |
'" target="_blank">'.$hash{'title_'.$ResId}.$Dummy.'</a>'; |
'" target="_blank">'.$cache->{'title_'.$ResId}.$Dummy.'</a>'; |
|
|
my $res = &Apache::lonnet::declutter($hash{'src_'.$ResId}); |
my $res = &Apache::lonnet::declutter($cache->{'src_'.$ResId}); |
my $urlres=$res; |
my $urlres=$res; |
|
|
$ResId=~/(\d+)\.(\d+)/; |
$ResId=~/(\d+)\.(\d+)/; |
my $Map = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ); |
my $Map = &Apache::lonnet::declutter( $cache->{'map_id_'.$1} ); |
$urlres=$Map; |
$urlres=$Map; |
|
|
$res = '<a href="'.$hash{'src_'.$ResId}.'">'.$res.'</a>'; |
$res = '<a href="'.$cache->{'src_'.$ResId}.'">'.$res.'</a>'; |
#$Map = '<a href="'.$Map.'">'.$res.'</a>'; |
#$Map = '<a href="'.$Map.'">'.$res.'</a>'; |
|
|
#------------------------ Compute the Average of Tries about one problem |
#------------------------ Compute the Average of Tries about one problem |
Line 772 sub BuildStatisticsTable {
|
Line 762 sub BuildStatisticsTable {
|
$YES.'&'.$Override.'&'.$Wrng.'&'.$DoD.'&'. |
$YES.'&'.$Override.'&'.$Wrng.'&'.$DoD.'&'. |
$SD.'&'.$Sk.'&'.$_D1.'&'.$_D2.'&'. |
$SD.'&'.$Sk.'&'.$_D1.'&'.$_D2.'&'. |
$DiscNo.'&'.$Prob; |
$DiscNo.'&'.$Prob; |
$CachData{($p_count-1)}=$join; |
##8888 $CachData{($p_count-1)}=$join; |
|
|
#6666666 |
#6666666 |
# $r->print('<br>'.$out.'&'.$DoD); |
# $r->print('<br>'.$out.'&'.$DoD); |
Line 784 sub BuildStatisticsTable {
|
Line 774 sub BuildStatisticsTable {
|
&Apache::lonnet::put('resevaldata',\%storestats,$1,$2); |
&Apache::lonnet::put('resevaldata',\%storestats,$1,$2); |
} |
} |
#-------------------------------- Row of statistical table |
#-------------------------------- Row of statistical table |
&TableRow($cache,$join,$i,($p_count-1)); |
&TableRow($cache,$join,$i,($p_count-1),$r,\%color,\%GraphDat); |
} |
} |
&CloseTable($cache); |
&CloseTable($cache,$r); |
} |
} |
&Close_PrgWin(); |
&Close_PrgWin(); |
#666666 |
#666666 |
Line 796 sub BuildStatisticsTable {
|
Line 786 sub BuildStatisticsTable {
|
|
|
=pod |
=pod |
sub Cache_Statistics { |
sub Cache_Statistics { |
my ($cache)=@_; |
my ($cache,$color)=@_; |
my @list = (); |
my @list = (); |
my $Useful; |
my $Useful; |
my $UnUseful; |
my $UnUseful; |
Line 829 sub Cache_Statistics {
|
Line 819 sub Cache_Statistics {
|
for (my $i=1; $i<=$#lpr; $i++) { |
for (my $i=1; $i<=$#lpr; $i++) { |
my($Pre, $Post) = split(/\@/,$list[$nIndex]); |
my($Pre, $Post) = split(/\@/,$list[$nIndex]); |
#$r->print('<br>'.$Pre.'---'.$Post); |
#$r->print('<br>'.$Pre.'---'.$Post); |
&TableRow($cache,$Post,$i,$nIndex); |
&TableRow($cache,$Post,$i,$nIndex,\%color,\%GraphDat); |
$nIndex++; |
$nIndex++; |
} |
} |
&CloseTable($cache); |
&CloseTable($cache); |
Line 839 sub Cache_Statistics {
|
Line 829 sub Cache_Statistics {
|
&CreateProblemStatisticsTableHeading($cache,0); |
&CreateProblemStatisticsTableHeading($cache,0); |
for ( my $nIndex = 0; $nIndex < $p_count; $nIndex++ ) { |
for ( my $nIndex = 0; $nIndex < $p_count; $nIndex++ ) { |
my($Pre, $Post) = split(/\@/,$list[$nIndex]); |
my($Pre, $Post) = split(/\@/,$list[$nIndex]); |
&TableRow($cache,$Post,$nIndex,$nIndex); |
&TableRow($cache,$Post,$nIndex,$nIndex,\%color,\%GraphDat); |
} |
} |
&CloseTable($cache); |
&CloseTable($cache); |
} |
} |
Line 847 sub Cache_Statistics {
|
Line 837 sub Cache_Statistics {
|
=cut |
=cut |
|
|
sub TableRow { |
sub TableRow { |
my ($Str,$Idx,$RealIdx)=@_; |
my ($cache,$Str,$Idx,$RealIdx,$r,$color,$GraphDat)=@_; |
my($PrOrd,$Temp,$StdNo,$TotalTries,$MxTries,$Avg,$YES,$Override, |
my($PrOrd,$Temp,$StdNo,$TotalTries,$MxTries,$Avg,$YES,$Override, |
$Wrng,$DoD,$SD,$Sk,$_D1,$_D2,$DiscNo,$Prob)=split(/\&/,$Str); |
$Wrng,$DoD,$SD,$Sk,$_D1,$_D2,$DiscNo,$Prob)=split(/\&/,$Str); |
if ($ENV{'form.showcsv'}) { |
if ($ENV{'form.showcsv'}) { |
my ($ResId,$Dummy)=split(/\*/,$Prob); |
my ($ResId,$Dummy)=split(/\*/,$Prob); |
my $Ptr = "\n".'<br>'. |
my $Ptr = "\n".'<br>'. |
"\n".'"'.($RealIdx+1).'",'. |
"\n".'"'.($RealIdx+1).'",'. |
"\n".'"'.$hash{'title_'.$ResId}.$Dummy.'",'. |
"\n".'"'.$cache->{'title_'.$ResId}.$Dummy.'",'. |
"\n".'"'.$hash{'src_'.$ResId}.'",'. |
"\n".'"'.$cache->{'src_'.$ResId}.'",'. |
"\n".'"'.$StdNo.'",'. |
"\n".'"'.$StdNo.'",'. |
"\n".'"'.$TotalTries.'",'. |
"\n".'"'.$TotalTries.'",'. |
"\n".'"'.$MxTries.'",'. |
"\n".'"'.$MxTries.'",'. |
Line 877 sub TableRow {
|
Line 867 sub TableRow {
|
"\n".'<td>'.($RealIdx+1).'</td>'. |
"\n".'<td>'.($RealIdx+1).'</td>'. |
# "\n".'<td>'.$PrOrd.$Temp.'</td>'. |
# "\n".'<td>'.$PrOrd.$Temp.'</td>'. |
"\n".'<td>'.$Temp.'</td>'. |
"\n".'<td>'.$Temp.'</td>'. |
"\n".'<td bgcolor='.$color{"yellow"}.'> '.$StdNo.'</td>'. |
"\n".'<td bgcolor='.$color->{"yellow"}.'> '.$StdNo.'</td>'. |
"\n".'<td bgcolor='.$color{"yellow"}.'>'.$TotalTries.'</td>'. |
"\n".'<td bgcolor='.$color->{"yellow"}.'>'.$TotalTries.'</td>'. |
"\n".'<td bgcolor='.$color{"yellow"}.'>'.$MxTries.'</td>'. |
"\n".'<td bgcolor='.$color->{"yellow"}.'>'.$MxTries.'</td>'. |
"\n".'<td bgcolor='.$color{"gb"}.'>'.$Avg.'</td>'. |
"\n".'<td bgcolor='.$color->{"gb"}.'>'.$Avg.'</td>'. |
"\n".'<td bgcolor='.$color{"gb"}.'> '.$YES.'</td>'. |
"\n".'<td bgcolor='.$color->{"gb"}.'> '.$YES.'</td>'. |
"\n".'<td bgcolor='.$color{"gb"}.'> '.$Override.'</td>'. |
"\n".'<td bgcolor='.$color->{"gb"}.'> '.$Override.'</td>'. |
"\n".'<td bgcolor='.$color{"red"}.'> '.$Wrng.'</td>'. |
"\n".'<td bgcolor='.$color->{"red"}.'> '.$Wrng.'</td>'. |
"\n".'<td bgcolor='.$color{"red"}.'> '.$DoD.'</td>'. |
"\n".'<td bgcolor='.$color->{"red"}.'> '.$DoD.'</td>'. |
"\n".'<td bgcolor='.$color{"green"}.'> '.$SD.'</td>'. |
"\n".'<td bgcolor='.$color->{"green"}.'> '.$SD.'</td>'. |
"\n".'<td bgcolor='.$color{"green"}.'> '.$Sk.'</td>'. |
"\n".'<td bgcolor='.$color->{"green"}.'> '.$Sk.'</td>'. |
"\n".'<td bgcolor='.$color{"purple"}.'> '.$_D1.'</td>'. |
"\n".'<td bgcolor='.$color->{"purple"}.'> '.$_D1.'</td>'. |
"\n".'<td bgcolor='.$color{"purple"}.'> '.$_D2.'</td>'. |
"\n".'<td bgcolor='.$color->{"purple"}.'> '.$_D2.'</td>'. |
"\n".'<td bgcolor='.$color{"yellow"}.'> '.$DiscNo.'</td>'; |
"\n".'<td bgcolor='.$color->{"yellow"}.'> '.$DiscNo.'</td>'; |
$r->print("\n".$Ptr.'</tr>' ); |
$r->print("\n".$Ptr.'</tr>' ); |
} |
} |
$GraphDat{$RealIdx}=$DoD.':'.$Wrng; |
$GraphDat->{$RealIdx}=$DoD.':'.$Wrng; |
} |
} |
|
|
sub StatusOptions { |
sub StatusOptions { |
Line 990 sub ProblemStatisticsLegend {
|
Line 980 sub ProblemStatisticsLegend {
|
$Ptr .= '<td>Percentage of students tried to solve the problem '; |
$Ptr .= '<td>Percentage of students tried to solve the problem '; |
$Ptr .= 'but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]'; |
$Ptr .= 'but still incorrect. [ 100*((#Stdnts-(#YES+#yes))/#Stdnts) ]'; |
$Ptr .= '</td></tr><tr><td>'; |
$Ptr .= '</td></tr><tr><td>'; |
# Kashy formula |
|
# '<b> DoDiff </b>: Degree of Difficulty of the problem.<br>'. |
|
# '[ Tries/(#YES+#yes+0.1) ]<br>'. |
|
#Gerd formula |
|
$Ptr .= '<b>DoDiff</b>:</td>'; |
$Ptr .= '<b>DoDiff</b>:</td>'; |
$Ptr .= '<td>Degree of Difficulty of the problem. '; |
$Ptr .= '<td>Degree of Difficulty of the problem. '; |
$Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]'; |
$Ptr .= '[ 1 - ((#YES+#yes) / Tries) ]'; |
Line 1031 sub ProblemStatisticsLegend {
|
Line 1017 sub ProblemStatisticsLegend {
|
# ------------------------------------------- Prepare data for Graphical chart |
# ------------------------------------------- Prepare data for Graphical chart |
|
|
sub GetGraphData { |
sub GetGraphData { |
my $ylab = shift; |
my ($ylab,$r,%GraphDat)=@_; |
my $Col; |
my $Col; |
my $data=''; |
my $data=''; |
my $count = 0; |
my $count = 0; |