--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/05 20:53:38 1.13 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/06 02:01:05 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.13 2002/08/05 20:53:38 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.14 2002/08/06 02:01:05 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -105,7 +105,7 @@ sub BuildProblemStatisticsPage { # 'ProblemStatisticsHeading', # 'ProblemStatisticsHeading', # 'Homework Sets Order'); - $r->print("
state=".$state); +# $r->print("
state=".$state); my $TempCache; @@ -146,12 +146,6 @@ sub BuildProblemStatisticsPage { #---- Problem Statistics Web Page --------------------------------------- - -sub NumericSort { - $a <=> $b; -} - - sub CreateProblemStatisticsTableHeading { my ($displayFormat,$sequenceSource,$sequenceTitle,$headings,$r)=@_; if($displayFormat eq 'Display CSV Format') { @@ -159,10 +153,12 @@ sub CreateProblemStatisticsTableHeading $r->print($sequenceSource.'"'); return; } - - $r->print('
'.$sequenceTitle.''); - + if ($sequenceSource eq 'Sorted by: ') { + $r->print('
'.$sequenceSource.$sequenceTitle.''); + } else { + $r->print('
'.$sequenceTitle.''); + } my $Result = "\n".''."\n"; for(my $nIndex=0; $nIndex < (scalar (keys %$headings)); $nIndex++) { $Result .= ''. - # "\n".''. "\n".''. "\n".''. "\n".''. @@ -740,7 +722,7 @@ sub TableRow { "\n".''; $r->print("\n".$Ptr.'' ); } - $GraphDat->{'graph_gif:'.$RealIdx}=$DoD.':'.$Wrng; + $GraphDat->{'GraphGif:'.$RealIdx}=$DoD.':'.$Wrng; } @@ -940,47 +922,48 @@ sub BuildWrongGraph { sub GetGraphData { - my ($ylab,$r,%GraphDat)=@_; + my ($ylab,$r,$cache)=@_; my $Col; my $data=''; my $count = 0; my $Max = 0; my $cid=$ENV{'request.course.id'}; - my $GraphDB = "/home/httpd/perl/tmp/$ENV{'user.name'}". - "_$ENV{'user.domain'}_$cid\_graph.db"; - foreach (keys %GraphDat) {delete $GraphDat{$_};} - if (-e "$GraphDB") { - if (tie(%GraphDat,'GDBM_File',"$GraphDB",&GDBM_READER,0640)) { - if ( $ylab eq 'DoDiff Graph' ) { - $ylab = 'Degree-of-Difficulty'; - $Col = 0; - } - else { - $ylab = 'Wrong-Percentage'; - $Col = 1; - } - foreach (sort NumericSort keys %GraphDat) { - my @Temp=split(/\:/,$GraphDat{$_}); - my $inf = $Temp[$Col]; - if ( $Max < $inf ) {$Max = $inf;} - $data .= $inf.','; - $count++; - } - if ( $Max > 1 ) { - $Max += (10 - $Max % 10); - $Max = int($Max); - } - else { $Max = 1; } - untie(%GraphDat); - my $Course = $ENV{'course.'.$cid.'.description'}; - $Course =~ s/\ /"_"/eg; - my $GData=$Course.'&'.'Problems'.'&'.$ylab.'&'. - $Max.'&'.$count.'&'.$data; - } - else { - $r->print("Unable to tie hash to db file"); - } + + if ( $ylab eq 'DoDiff Graph' ) { + $ylab = 'Degree-of-Difficulty'; + $Col = 0; } + else { + $ylab = 'Wrong-Percentage'; + $Col = 1; + } + + my $p_count = $cache->{'ProblemCount'}; + + for ( my $k=0; $k<$p_count;$k++) { + my $key=$cache->{'CacheTable:'.$k}; + my @Temp=split(/\&/,$key); + # $list[$k]=$key; + } + + # foreach (sort NumericSort keys %GraphDat) { + # my @Temp=split(/\:/,$GraphDat{$_}); + # my $inf = $Temp[$Col]; + # if ( $Max < $inf ) {$Max = $inf;} + # $data .= $inf.','; + # $count++; + # } + if ( $Max > 1 ) { + $Max += (10 - $Max % 10); + $Max = int($Max); + } else { $Max = 1; } + + #untie(%GraphDat); + + my $Course = $ENV{'course.'.$cid.'.description'}; + $Course =~ s/\ /"_"/eg; + my $GData=$Course.'&'.'Problems'.'&'.$ylab.'&'. + $Max.'&'.$count.'&'.$data; }
P#'.''. "\n".''.($RealIdx+1).''.$PrOrd.$Temp.''.$Temp.' '.$StdNo.''.$TotalTries.' '.$DiscNo.'