version 1.15, 2002/08/06 02:07:19
|
version 1.17, 2002/08/09 19:49:30
|
Line 47 use GDBM_File;
|
Line 47 use GDBM_File;
|
sub BuildProblemStatisticsPage { |
sub BuildProblemStatisticsPage { |
my ($cacheDB, $students, $courseID, $c, $r)=@_; |
my ($cacheDB, $students, $courseID, $c, $r)=@_; |
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 101 sub BuildProblemStatisticsPage {
|
Line 101 sub BuildProblemStatisticsPage {
|
|
|
my $state=$ENV{'form.ProblemStatisticsHeading'}; |
my $state=$ENV{'form.ProblemStatisticsHeading'}; |
|
|
# my $state=&Apache::lonstatistics::CheckFormElement(\%cache, |
|
# 'ProblemStatisticsHeading', |
|
# 'ProblemStatisticsHeading', |
|
# 'Homework Sets Order'); |
|
# $r->print("<br>state=".$state); |
|
|
|
my $TempCache; |
my $TempCache; |
|
|
if ($state) { |
if ($state) { |
Line 119 sub BuildProblemStatisticsPage {
|
Line 113 sub BuildProblemStatisticsPage {
|
my $index=0; |
my $index=0; |
foreach (@$students) { |
foreach (@$students) { |
$index++; |
$index++; |
#&Apache::lonstatistics::Update_PrgWin(++$index,$r); |
|
&ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, |
&ExtractStudentData(\%cache, $_, \@list,\%Discuss, $r, |
\%discriminant); |
\%discriminant); |
} |
} |
#&Apache::lonstatistics::Close_PrgWin($r); |
|
my ($upper, $lower) = &Discriminant(\%discriminant,$r); |
my ($upper, $lower) = &Discriminant(\%discriminant,$r); |
$TempCache= &BuildStatisticsTable(\%cache, $upper, $lower, |
$TempCache= &BuildStatisticsTable(\%cache, $upper, $lower, |
\@list, \%Header, $students, |
\@list, \%Header, $students, |
Line 241 sub ExtractStudentData {
|
Line 233 sub ExtractStudentData {
|
my $tempProblemOrder=100; |
my $tempProblemOrder=100; |
if($cache->{'ProblemStatisticsMaps'} ne 'All Maps' && |
if($cache->{'ProblemStatisticsMaps'} ne 'All Maps' && |
$cache->{'ProblemStatisticsMaps'} ne $cache->{$sequence.':title'}) { |
$cache->{'ProblemStatisticsMaps'} ne $cache->{$sequence.':title'}) { |
# $r->print("<br>sequences=$cache->{'orderedSequences'}"); |
|
# $r->print("<br>".$cache->{$sequence.':title'}); |
|
next; |
next; |
} |
} |
$tempSequenceOrder++; |
$tempSequenceOrder++; |
|
|
#$discrim .= '&'; |
|
foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { |
foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { |
# $r->print("<br>problems=$cache->{$sequence.':problems'}"); |
|
my $problem = $cache->{$problemID.':problem'}; |
my $problem = $cache->{$problemID.':problem'}; |
# $r->print("<br>$problemID === $problem"); |
|
my $LatestVersion = $cache->{$name.':version:'.$problem}; |
my $LatestVersion = $cache->{$name.':version:'.$problem}; |
# Output dashes for all the parts of this problem if there |
# Output dashes for all the parts of this problem if there |
# is no version information about the current problem. |
# is no version information about the current problem. |
Line 275 sub ExtractStudentData {
|
Line 262 sub ExtractStudentData {
|
':parts'})) { |
':parts'})) { |
$tempProblemOrder++; |
$tempProblemOrder++; |
$partData{'count'}++; |
$partData{'count'}++; |
# $r->print("<br>parts=$cache->{$sequence.':'.$problemID.':parts'}"); |
|
$partData{$part.':order'}=$tempProblemOrder; |
$partData{$part.':order'}=$tempProblemOrder; |
$partData{$part.':tries'}=0; |
$partData{$part.':tries'}=0; |
$partData{$part.':code'}='-'; |
$partData{$part.':code'}='-'; |
Line 327 sub ExtractStudentData {
|
Line 313 sub ExtractStudentData {
|
} |
} |
} |
} |
|
|
#$Apache::lonxml::debug=1; |
|
#&Apache::lonhomework::showhash(%partData); |
|
#$Apache::lonxml::debug=0; |
|
|
|
# Loop through all the parts for the current problem in the |
# Loop through all the parts for the current problem in the |
# correct order and prepare the output |
# correct order and prepare the output |
my $partCounter=0; |
my $partCounter=0; |
Line 348 sub ExtractStudentData {
|
Line 330 sub ExtractStudentData {
|
if($partData{'count'} > 1) { |
if($partData{'count'} > 1) { |
$ptr .= "*(part $_)"; |
$ptr .= "*(part $_)"; |
} |
} |
#if($partCounter > 1) { |
$discrim .= '&'; |
$discrim .= '&'; |
|
#} |
|
|
|
my ($pr_no,$dod)=split('&',$ptr); |
my ($pr_no,$dod)=split('&',$ptr); |
# my $DoDiff=$DoDiff->{$dod}; |
# my $DoDiff=$DoDiff->{$dod}; |
Line 498 sub BuildStatisticsTable {
|
Line 478 sub BuildStatisticsTable {
|
$p_count++; |
$p_count++; |
my $Dummy; |
my $Dummy; |
($ResId,$Dummy)=split(/\*/,$Temp); |
($ResId,$Dummy)=split(/\*/,$Temp); |
|
|
###################### |
|
$Temp = '<a href="'.$cache->{$ResId.':source'}. |
$Temp = '<a href="'.$cache->{$ResId.':source'}. |
'" target="_blank">'.$cache->{$ResId.':title'}.$Dummy.'</a>'; |
'" target="_blank">'.$cache->{$ResId.':title'}.$Dummy.'</a>'; |
|
|
#$r->print('<br>rid='.$ResId); |
# my $urlres = $cache->{$sequence.':source'}); |
#$r->print('<br>src='.$cache->{$ResId.':source'}); |
#check with Gerd |
#$r->print('<br>tit='.$cache->{$ResId.':title'}); |
#symb of the problem (already decluttered and cleaned) |
|
my $urlres = $cache->{$ResId.':problem'}; |
my $res = &Apache::lonnet::declutter($cache->{$ResId.':source'}); |
|
my $urlres=$res; |
|
|
|
$ResId=~/(\d+)\.(\d+)/; |
|
my $Map = &Apache::lonnet::declutter( $cache->{'map_id_'.$1} ); |
|
$urlres=$Map; |
|
####################### |
|
|
|
# $res = '<a href="'.$cache->{$ResId.':source'}.'">'.$res.'</a>'; |
|
#$Map = '<a href="'.$Map.'">'.$res.'</a>'; |
|
|
|
#------------------------ Compute the Average of Tries about one problem |
#------------------------ Compute the Average of Tries about one problem |
my $Average = ($StdNo) ? $TotalTries/$StdNo : 0; |
my $Average = ($StdNo) ? $TotalTries/$StdNo : 0; |
Line 524 sub BuildStatisticsTable {
|
Line 492 sub BuildStatisticsTable {
|
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___timestamp'}=time; |
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___timestamp'}=time; |
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___stdno'}=$StdNo; |
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___stdno'}=$StdNo; |
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___avetries'}=$Average; |
$storestats{$ENV{'request.course.id'}.'___'.$urlres.'___avetries'}=$Average; |
|
|
#-------------------------------- Compute percentage of Wrong tries |
#-------------------------------- Compute percentage of Wrong tries |
my $Wrong = ( $StdNo ) ? 100 * ( $Incorrect / $StdNo ) : 0; |
my $Wrong = ( $StdNo ) ? 100 * ( $Incorrect / $StdNo ) : 0; |
|
|
Line 581 sub BuildStatisticsTable {
|
Line 549 sub BuildStatisticsTable {
|
$SD.'&'.$Sk.'&'.$_D1.'&'.$_D2.'&'. |
$SD.'&'.$Sk.'&'.$_D1.'&'.$_D2.'&'. |
$DiscNo.'&'.$Prob; |
$DiscNo.'&'.$Prob; |
|
|
#####{$sequence.'@'.$pOrd} |
|
$TempCache{'CacheTable:'.($p_count-1)}=$join; |
$TempCache{'CacheTable:'.($p_count-1)}=$join; |
|
|
#6666666 |
#6666666 |
Line 589 sub BuildStatisticsTable {
|
Line 556 sub BuildStatisticsTable {
|
# print (OUT $out.'@'.$DoD.'&'); |
# print (OUT $out.'@'.$DoD.'&'); |
#6666666 |
#6666666 |
|
|
|
#check with Gerd |
$urlres=~/^(\w+)\/(\w+)/; |
$urlres=~/^(\w+)\/(\w+)/; |
if ($StdNo) { |
if ($StdNo) { |
&Apache::lonnet::put('resevaldata',\%storestats,$1,$2); |
&Apache::lonnet::put('nohist_resevaldata',\%storestats, |
} |
$1,$2); |
|
} |
#-------------------------------- Row of statistical table |
#-------------------------------- Row of statistical table |
&TableRow($cache,$join,$cIdx,($p_count-1),$r,$color, |
&TableRow($cache,$join,$cIdx,($p_count-1),$r,$color, |
\%TempCache); |
\%TempCache); |
Line 624 sub CacheStatisticsTable {
|
Line 593 sub CacheStatisticsTable {
|
} |
} |
|
|
if ($pos>0) { |
if ($pos>0) { |
# $r->print('<br>pos1='.$pos); |
|
@list = sort OrderedSort (@list); |
@list = sort OrderedSort (@list); |
} else { |
} else { |
@list = sort (@list); |
@list = sort (@list); |
Line 863 sub ProcessDiscriminant {
|
Line 831 sub ProcessDiscriminant {
|
#------- Creating Discimination factor |
#------- Creating Discimination factor |
sub Discriminant { |
sub Discriminant { |
my ($discriminant,$r)=@_; |
my ($discriminant,$r)=@_; |
#$Apache::lonxml::debug=1; |
|
#&Apache::lonhomework::showhash(%$discriminant); |
|
#$Apache::lonxml::debug=0; |
|
my @discriminantKeys=keys(%$discriminant); |
my @discriminantKeys=keys(%$discriminant); |
my $Count = scalar @discriminantKeys; |
my $Count = scalar @discriminantKeys; |
|
|
Line 901 sub Discriminant {
|
Line 866 sub Discriminant {
|
|
|
# ------------------------------------------- Prepare data for Graphical chart |
# ------------------------------------------- Prepare data for Graphical chart |
|
|
sub BuildDiffGraph { |
sub BuildGraphicChart { |
my ($r)=@_; |
my ($ylab,$r,$cacheDB)=@_; |
|
my %cache; |
my $graphData = &GetGraphData('DiffGraph', $r); |
|
$r->print('<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'); |
|
|
|
return; |
|
} |
|
|
|
sub BuildWrongGraph { |
|
my ($r)=@_; |
|
|
|
my $graphData = &GetGraphData('WrongGraph', $r); |
|
$r->print('<IMG src="/cgi-bin/graph.gif?'.$graphData.'" />'); |
|
|
|
return; |
|
} |
|
|
|
|
|
sub GetGraphData { |
|
my ($ylab,$r,$cache)=@_; |
|
my $Col; |
my $Col; |
my $data=''; |
my $data=''; |
my $count = 0; |
my $count = 0; |
my $Max = 0; |
my $Max = 0; |
my $cid=$ENV{'request.course.id'}; |
|
|
|
if ( $ylab eq 'DoDiff Graph' ) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) { |
$ylab = 'Degree-of-Difficulty'; |
return '<html><body>Unable to tie database.</body></html>'; |
$Col = 0; |
|
} |
|
else { |
|
$ylab = 'Wrong-Percentage'; |
|
$Col = 1; |
|
} |
} |
|
|
my $p_count = $cache->{'ProblemCount'}; |
my $p_count = $cache{'ProblemCount'}; |
|
|
for ( my $k=0; $k<$p_count;$k++) { |
for ( my $k=0; $k<$p_count;$k++) { |
my $key=$cache->{'CacheTable:'.$k}; |
my @Temp=split(/\:/,$cache{'GraphGif:'.$k}); |
my @Temp=split(/\&/,$key); |
my $inf = $Temp[$Col]; |
# $list[$k]=$key; |
if ( $Max < $inf ) {$Max = $inf;} |
|
$data .= $inf.','; |
|
$count++; |
} |
} |
|
untie(%cache); |
|
# $r->print("<br>count=$p_count >>data= $data"); |
|
|
# foreach (sort NumericSort keys %GraphDat) { |
|
# my @Temp=split(/\:/,$GraphDat{$_}); |
|
# my $inf = $Temp[$Col]; |
|
# if ( $Max < $inf ) {$Max = $inf;} |
|
# $data .= $inf.','; |
|
# $count++; |
|
# } |
|
if ( $Max > 1 ) { |
if ( $Max > 1 ) { |
$Max += (10 - $Max % 10); |
$Max += (10 - $Max % 10); |
$Max = int($Max); |
$Max = int($Max); |
} else { $Max = 1; } |
} else { $Max = 1; } |
|
|
#untie(%GraphDat); |
my $cid=$ENV{'request.course.id'}; |
|
|
|
if ( $ylab eq 'DoDiff Graph' ) { |
|
$ylab = 'Degree-of-Difficulty'; |
|
$Col = 0; |
|
} else { |
|
$ylab = 'Wrong-Percentage'; |
|
$Col = 1; |
|
} |
my $Course = $ENV{'course.'.$cid.'.description'}; |
my $Course = $ENV{'course.'.$cid.'.description'}; |
$Course =~ s/\ /"_"/eg; |
$Course =~ s/\ /"_"/eg; |
my $GData=$Course.'&'.'Problems'.'&'.$ylab.'&'. |
my $GData=$Course.'&'.'Problems#'.'&'.$ylab.'&'. |
$Max.'&'.$count.'&'.$data; |
$Max.'&'.$count.'&'.$data; |
} |
|
|
|
|
$r->print('<IMG src="/cgi-bin/graph.gif?'.$GData.'" />'); |
|
|
|
return; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |