--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/14 21:51:51 1.28 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/30 15:35:08 1.31 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.28 2002/08/14 21:51:51 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.31 2002/08/30 15:35:08 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -123,7 +123,7 @@ sub InitializeProblemStatistics { my $problemData; if($isNotCached) { ($problemData) = &ExtractStudentData(\%cache, $students); - &CalculateStatistics($problemData, \%cache); + &CalculateStatistics($problemData, \%cache, $courseID); } untie(%cache); @@ -173,15 +173,15 @@ sub BuildProblemStatisticsPage { $Ptr .= '<table border="0" cellspacing="5"><tbody>'; $Ptr .= '<tr><td align="right"><b>Select Map</b></td>'."\n"; $Ptr .= '<td align="left">'; - $Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'ProblemStatistics', + $Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'Statistics', 'Statistics'); $Ptr .= '</td></tr>'."\n"; $Ptr .= '<tr><td align="right"><b>Sorting Type:</b></td>'."\n"; $Ptr .= '<td align="left">'."\n"; $Ptr .= &Apache::lonhtmlcommon::AscendOrderOptions( - $cache{'ProblemStatisticsAscend'}, - 'ProblemStatistics', - 'Statistics'); + $cache{'ProblemStatisticsAscend'}, + 'ProblemStatistics', + 'Statistics'); $Ptr .= '</td></tr>'."\n"; $Ptr .= '<tr><td align="right"><b>Select Sections</b>'; $Ptr .= '</td>'."\n"; @@ -507,8 +507,8 @@ sub ProblemStatisticsLegend { $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 - '; - $Ptr .= 'Applied the same Criterion in %27 Lower Students]</b><br>'; + $Ptr .= '<b>[Criterion to group students into %27 Upper Students - '; + $Ptr .= 'and %27 Lower Students]</b><br>'; $Ptr .= '<b>1st Criterion</b> for Sorting the Students: '; $Ptr .= '<b>Sum of Partial Credit Awarded / Total Number of Tries</b><br>'; $Ptr .= '<b>2nd Criterion</b> for Sorting the Students: '; @@ -699,7 +699,7 @@ sub SortProblems { } sub CalculateStatistics { - my ($data, $cache)=@_; + my ($data, $cache, $courseID)=@_; my @problems = split(':::', $data->{'problemList'}); foreach(@problems) { @@ -797,6 +797,22 @@ sub CalculateStatistics { my $df2 = $upper2Sum - $lower2Sum; $data->{$_.':discriminationFactor2'} = sprintf("%.2f", $df2); + + my %storestats; + my $Average = ($data->{$_.':studentCount'}) ? + $data->{$_.':totalTries'}/$data->{$_.':studentCount'} : 0; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___timestamp'}=time; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___stdno'}=$data->{$_.':studentCount'}; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___avetries'}=$Average; + $storestats{$courseID.'___'.$cache->{$sequence.':source'}. + '___difficulty'}=$data->{$_.':degreeOfDifficulty'}; + $cache->{$sequence.':source'} =~ /^(\w+)\/(\w+)/; + if($data->{$_.':studentCount'}) { + &Apache::lonnet::put('resevaldata',\%storestats,$1,$2); + } } return;