'."\n");
+ $r->print(''."\n");
+ $r->print(&CreateProblemStatisticsTableHeading($headings, $r));
+ } else {
+ $r->print(' ');
+ }
- &CreateProblemStatisticsTableHeading(1,$cache->{$sequence.':source'},
- $cache->{$sequence.':title'},
- $headings,$r);
-
- my ($tar,$Tries,$Wrongs,$Code,$Disc)=split(/\&/,
- $List[$cIdx]);
-
- my ($SqOrd,$PrOrd,$Prob)=split(/\:/,$tar);
- $sequence+=100;
- while ($SqOrd==$sequence && $cIdx<$NoElements) {
- my %storestats=();
- my $pOrd=$PrOrd;
- my $Temp = $Prob;
- my $MxTries = 0;
- my $TotalTries = 0;
- my $YES = 0;
- my $Incorrect = 0;
- my $Override = 0;
- my $StdNo = 0;
- my $DiscNo=0;
- my @StdLst;
- while ($pOrd==$PrOrd && $cIdx<$NoElements)
- {
- $cIdx++;
- $StdNo++;
- $StdLst[ $StdNo ] = $Tries;
- $TotalTries += $Tries;
- if ( $MxTries < $Tries ) { $MxTries = $Tries; }
- if ( $Code eq 'C' ){ $YES++; }
- elsif( $Code eq 'I' ) { $Incorrect++; }
- elsif( $Code eq 'O' ) { $Override++; }
- elsif( $Code eq '-' ) { $StdNo--; }
- ($tar,$Tries,$Wrongs,$Code,$Disc)=split(/\&/,
- $List[$cIdx]);
- ($SqOrd,$PrOrd,$Prob)=split(/\:/,$tar);
-
-#$r->print(" $cIdx ... $SqOrd, $PrOrd, $Tries, $Wrongs, $Code, $Disc");
-#$r->rflush();
-
- }
-
-#$r->print(" $cIdx ... $SqOrd , $Temp , $TotalTries");
-#$r->rflush();
-
- $p_count++;
- my $Dummy;
- ($ResId,$Dummy)=split(/\*/,$Temp);
-
-######################
- $Temp = ''.$cache->{$ResId.':title'}.$Dummy.'';
-
- my $res = &Apache::lonnet::declutter($cache->{'src_'.$ResId});
- my $urlres=$res;
-
- $ResId=~/(\d+)\.(\d+)/;
- my $Map = &Apache::lonnet::declutter( $cache->{'map_id_'.$1} );
- $urlres=$Map;
-#######################
-
-# $res = ''.$res.'';
- #$Map = ''.$res.'';
-
-#------------------------ Compute the Average of Tries about one problem
- my $Average = ($StdNo) ? $TotalTries/$StdNo : 0;
-
- $storestats{$ENV{'request.course.id'}.'___'.$urlres.'___timestamp'}=time;
- $storestats{$ENV{'request.course.id'}.'___'.$urlres.'___stdno'}=$StdNo;
- $storestats{$ENV{'request.course.id'}.'___'.$urlres.'___avetries'}=$Average;
-
-#-------------------------------- Compute percentage of Wrong tries
- my $Wrong = ( $StdNo ) ? 100 * ( $Incorrect / $StdNo ) : 0;
+ my $count = 1;
+ foreach(@$orderedProblems) {
+ my ($sequence,$problem,$part)=split(':', $_);
+ if($cache->{'ProblemStatisticsMaps'} ne 'All Maps' &&
+ $cache->{'ProblemStatisticsMaps'} ne $cache->{$sequence.':title'}) {
+ next;
+ }
-#-------------------------------- Compute Standard Deviation
- my $StdDev = 0;
- if ( $StdNo > 1 ) {
- for ( my $n = 0; $n < $StdNo; $n++ ) {
- my $Dif = $StdLst[ $n ]-$Average;
- $StdDev += $Dif*$Dif;
- }
- $StdDev /= ( $StdNo - 1 );
- $StdDev = sqrt( $StdDev );
- }
-
-#-------------------------------- Compute Degree of Difficulty
- my $DoDiff = 0;
- if( $TotalTries > 0 ) {
- $DoDiff = 1 - ( ( $YES + $Override ) / $TotalTries );
-# $DoDiff = ($TotalTries)/($YES + $Override+ 0.1);
- }
-
- $storestats{$ENV{'request.course.id'}.'___'.$urlres.'___difficulty'}=$DoDiff;
-
-#-------------------------------- Compute the Skewness
- my $Skewness = 0;
- my $Sum = 0;
- if ( $StdNo > 0 && $StdDev > 0 ) {
- for ( my $n = 0; $n < $StdNo; $n++ ) {
- my $Dif = $StdLst[ $n ]-$Average;
- $Skewness += $Dif*$Dif*$Dif;
- }
- $Skewness /= $StdNo;
- $Skewness /= $StdDev*$StdDev*$StdDev;
- }
-
-#--------------------- Compute the Discrimination Factors
- my ($Up1,$Up2)=split(/\:/,':');#jason$DisUp->{$lpr[$i]});
- my ($Lw1,$Lw2)=split(/\:/,':');#jason$DisLow->{$lpr[$i]});
- my $Dis1 = $Up1 - $Lw1;
- my $Dis2 = $Up2 - $Lw2;
- my $_D1 = sprintf("%.2f", $Dis1);
- my $_D2 = sprintf("%.2f", $Dis2);
-
-#----------------- Some restition in presenting the float numbers
- my $Avg = sprintf( "%.2f", $Average );
- my $Wrng = sprintf( "%.1f", $Wrong );
- my $SD = sprintf( "%.1f", $StdDev );
- my $DoD = sprintf( "%.2f", $DoDiff );
- my $Sk = sprintf( "%.1f", $Skewness );
- my $join = $Prob.'&'.$Temp.'&'.$StdNo.'&'.
- $TotalTries.'&'.$MxTries.'&'.$Avg.'&'.
- $YES.'&'.$Override.'&'.$Wrng.'&'.$DoD.'&'.
- $SD.'&'.$Sk.'&'.$_D1.'&'.$_D2.'&'.
- $DiscNo.'&'.$Prob;
-##8888 $CachData{($p_count-1)}=$join;
+ my $ref = ''.$cache->{$problem.':title'}.'';
+# my $ref = $cache->{$problem.':title'};
+ my $title = $cache->{$problem.':title'};
+ my $source = 'source';
+ my $tableData = join('&', $ref, $title, $source,
+ $cache->{$_.':studentCount'},
+ $cache->{$_.':totalTries'},
+ $cache->{$_.':maxTries'},
+ sprintf("%.2f", $cache->{$_.':mean'}),
+ $cache->{$_.':correct'},
+ $cache->{$_.':correctByOverride'},
+ sprintf("%.1f", $cache->{$_.':percentWrong'}),
+ sprintf("%.2f", $cache->{$_.':degreeOfDifficulty'}),
+ sprintf("%.1f", $cache->{$_.':standardDeviation'}),
+ sprintf("%.1f", $cache->{$_.':skewness'}),
+ sprintf("%.2f", $cache->{$_.':discriminationFactor1'}),
+ sprintf("%.2f", $cache->{$_.':discriminationFactor2'}),
+ 0); # 0 is for discussion, need to figure out
#6666666
# $r->print(' '.$out.'&'.$DoD);
# print (OUT $out.'@'.$DoD.'&');
#6666666
- $urlres=~/^(\w+)\/(\w+)/;
- if ($StdNo) {
- &Apache::lonnet::put('resevaldata',\%storestats,$1,$2);
- }
+#check with Gerd
+# $urlres=~/^(\w+)\/(\w+)/;
+# if ($StdNo) {
+# &Apache::lonnet::put('nohist_resevaldata',\%storestats,
+# $1,$2);
+# }
#-------------------------------- Row of statistical table
- &TableRow($cache,$join,$cIdx,($p_count-1),$r,$color,\%GraphDat);
- }
- &CloseTable($cache,$r);
+ &TableRow($displayFormat,$tableData,$count,$r,$color);
+ $count++;
}
-### &Close_PrgWin();
-#666666
+ if($cache->{'DisplayFormat'} ne 'Display CSV Format') {
+ $r->print(' '."\n");
+ }
+ $r->print(' |