version 1.27, 2002/08/14 20:42:49
|
version 1.32, 2002/09/02 20:21:43
|
Line 52 sub InitializeProblemStatistics {
|
Line 52 sub InitializeProblemStatistics {
|
$jr = $r; |
$jr = $r; |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database.'); |
$r->print('Unable to tie database1.'); |
return ('ERROR', undef); |
return ('ERROR', undef); |
} |
} |
|
|
Line 80 sub InitializeProblemStatistics {
|
Line 80 sub InitializeProblemStatistics {
|
} |
} |
} |
} |
|
|
|
my $isNotCached = 0; |
my $lastStatus = (defined($cache{'StatisticsLastStatus'})) ? |
my $lastStatus = (defined($cache{'StatisticsLastStatus'})) ? |
$cache{'StatisticsLastStatus'} : 'Nothing'; |
$cache{'StatisticsLastStatus'} : 'Nothing'; |
my $whichStudents = join(':::',sort(@$students)); |
my $whichStudents = join(':::',sort(@$students)); |
if(!defined($cache{'StatisticsCached'}) || |
if(!defined($cache{'StatisticsCached'}) || |
$lastStatus ne $cache{'Status'} || |
$lastStatus ne $cache{'Status'} || |
$whichStudents ne $cache{'StatisticsWhichStudents'}) { |
$whichStudents ne $cache{'StatisticsWhichStudents'}) { |
if(defined($cache{'StatisticsCached'})) { |
$isNotCached = 1; |
untie(%cache); |
} |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { |
|
$r->print('Unable to tie database.'); |
untie(%cache); |
return ('ERROR', undef); |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { |
} |
$r->print('Unable to tie database.2'); |
my @statkeys = split(':::', $cache{'StatisticsKeys'}); |
return ('ERROR', undef); |
delete $cache{'StatisticsKeys'}; |
} |
delete $cache{'StatisticsCached'}; |
if($isNotCached && defined($cache{'StatisticsCached'})) { |
foreach(@statkeys) { |
my @statkeys = split(':::', $cache{'StatisticsKeys'}); |
delete $cache{$_}; |
delete $cache{'StatisticsKeys'}; |
} |
delete $cache{'StatisticsCached'}; |
|
foreach(@statkeys) { |
|
delete $cache{$_}; |
} |
} |
untie(%cache); |
} |
|
|
|
untie(%cache); |
|
if($isNotCached) { |
&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
&Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
'true', |
'true', |
$cacheDB, |
$cacheDB, |
Line 107 sub InitializeProblemStatistics {
|
Line 113 sub InitializeProblemStatistics {
|
'true', |
'true', |
$courseID, |
$courseID, |
$r, $c); |
$r, $c); |
if($c->aborted()) { return ('ERROR', undef); } |
} |
|
if($c->aborted()) { return ('ERROR', undef); } |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database.'); |
$r->print('Unable to tie database.3'); |
return ('ERROR', undef); |
return ('ERROR', undef); |
} |
} |
my ($problemData) = &ExtractStudentData(\%cache, $students); |
my $problemData; |
&CalculateStatistics($problemData, \%cache); |
if($isNotCached) { |
untie(%cache); |
($problemData) = &ExtractStudentData(\%cache, $students); |
|
&CalculateStatistics($problemData, \%cache, $courseID); |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { |
} |
$r->print('Unable to tie database.'); |
untie(%cache); |
return ('ERROR', undef); |
|
} |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { |
|
$r->print('Unable to tie database.4'); |
|
return ('ERROR', undef); |
|
} |
|
if($isNotCached) { |
foreach(keys(%$problemData)) { |
foreach(keys(%$problemData)) { |
$cache{$_} = $problemData->{$_}; |
$cache{$_} = $problemData->{$_}; |
} |
} |
Line 128 sub InitializeProblemStatistics {
|
Line 139 sub InitializeProblemStatistics {
|
$cache{'StatisticsCached'} = 'true'; |
$cache{'StatisticsCached'} = 'true'; |
$cache{'StatisticsLastStatus'} = $cache{'Status'}; |
$cache{'StatisticsLastStatus'} = $cache{'Status'}; |
$cache{'StatisticsWhichStudents'} = $whichStudents; |
$cache{'StatisticsWhichStudents'} = $whichStudents; |
untie(%cache); |
} |
|
untie(%cache); |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database.'); |
$r->print('Unable to tie database.5'); |
return ('ERROR', undef); |
return ('ERROR', undef); |
} |
|
} |
} |
|
|
my $orderedProblems = &SortProblems(\%cache, |
my $orderedProblems = &SortProblems(\%cache, |
$cache{'ProblemStatisticsSort'}, |
$cache{'ProblemStatisticsSort'}, |
$cache{'SortProblems'}, |
$cache{'SortProblems'}, |
$cache{'ProblemStatisticsAscend'}); |
$cache{'ProblemStatisticsAscend'}); |
|
untie(%cache); |
|
|
return ('OK', $orderedProblems); |
return ('OK', $orderedProblems); |
} |
} |
|
|
Line 153 sub BuildProblemStatisticsPage {
|
Line 166 sub BuildProblemStatisticsPage {
|
my %cache; |
my %cache; |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database.'); |
$r->print('Unable to tie database.6'); |
return; |
return; |
} |
} |
my $Ptr = ''; |
my $Ptr = ''; |
$Ptr .= '<table border="0" cellspacing="5"><tbody>'; |
$Ptr .= '<table border="0" cellspacing="5"><tbody>'; |
$Ptr .= '<tr><td align="right"><b>Select Map</b></td>'."\n"; |
$Ptr .= '<tr><td align="right"><b>Select Map</b></td>'."\n"; |
$Ptr .= '<td align="left">'; |
$Ptr .= '<td align="left">'; |
$Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'ProblemStatistics', |
$Ptr .= &Apache::lonhtmlcommon::MapOptions(\%cache, 'Statistics', |
'Statistics'); |
'Statistics'); |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '<tr><td align="right"><b>Sorting Type:</b></td>'."\n"; |
$Ptr .= '<tr><td align="right"><b>Sorting Type:</b></td>'."\n"; |
$Ptr .= '<td align="left">'."\n"; |
$Ptr .= '<td align="left">'."\n"; |
$Ptr .= &Apache::lonhtmlcommon::AscendOrderOptions( |
$Ptr .= &Apache::lonhtmlcommon::AscendOrderOptions( |
$cache{'ProblemStatisticsAscend'}, |
$cache{'ProblemStatisticsAscend'}, |
'ProblemStatistics', |
'ProblemStatistics', |
'Statistics'); |
'Statistics'); |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '<tr><td align="right"><b>Select Sections</b>'; |
$Ptr .= '<tr><td align="right"><b>Select Sections</b>'; |
$Ptr .= '</td>'."\n"; |
$Ptr .= '</td>'."\n"; |
Line 197 sub BuildProblemStatisticsPage {
|
Line 210 sub BuildProblemStatisticsPage {
|
} |
} |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database.'); |
$r->print('Unable to tie database.6'); |
return; |
return; |
} |
} |
&BuildStatisticsTable(\%cache, $cache{'DisplayFormat'}, |
&BuildStatisticsTable(\%cache, $cache{'DisplayFormat'}, |
Line 220 sub BuildGraphicChart {
|
Line 233 sub BuildGraphicChart {
|
} |
} |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
return 'Unable to tie database.'; |
return 'Unable to tie database.7'; |
} |
} |
|
|
my @problems = split(':::', $cache{'problemList'}); |
my @problems = split(':::', $cache{'problemList'}); |
Line 494 sub ProblemStatisticsLegend {
|
Line 507 sub ProblemStatisticsLegend {
|
$Ptr .= '<b>Dis.F.</b></td>'; |
$Ptr .= '<b>Dis.F.</b></td>'; |
$Ptr .= '<td>Discrimination Factor: A Standard for evaluating the '; |
$Ptr .= '<td>Discrimination Factor: A Standard for evaluating the '; |
$Ptr .= 'problem according to a Criterion<br>'; |
$Ptr .= 'problem according to a Criterion<br>'; |
$Ptr .= '<b>[Applied Criterion in %27 Upper Students - '; |
$Ptr .= '<b>[Criterion to group students into %27 Upper Students - '; |
$Ptr .= 'Applied the same Criterion in %27 Lower Students]</b><br>'; |
$Ptr .= 'and %27 Lower Students]</b><br>'; |
$Ptr .= '<b>1st Criterion</b> for Sorting the Students: '; |
$Ptr .= '<b>1st Criterion</b> for Sorting the Students: '; |
$Ptr .= '<b>Sum of Partial Credit Awarded / Total Number of Tries</b><br>'; |
$Ptr .= '<b>Sum of Partial Credit Awarded / Total Number of Tries</b><br>'; |
$Ptr .= '<b>2nd Criterion</b> for Sorting the Students: '; |
$Ptr .= '<b>2nd Criterion</b> for Sorting the Students: '; |
Line 686 sub SortProblems {
|
Line 699 sub SortProblems {
|
} |
} |
|
|
sub CalculateStatistics { |
sub CalculateStatistics { |
my ($data, $cache)=@_; |
my ($data, $cache, $courseID)=@_; |
|
|
my @problems = split(':::', $data->{'problemList'}); |
my @problems = split(':::', $data->{'problemList'}); |
foreach(@problems) { |
foreach(@problems) { |
Line 784 sub CalculateStatistics {
|
Line 797 sub CalculateStatistics {
|
|
|
my $df2 = $upper2Sum - $lower2Sum; |
my $df2 = $upper2Sum - $lower2Sum; |
$data->{$_.':discriminationFactor2'} = sprintf("%.2f", $df2); |
$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('nohist_resevaldata',\%storestats,$1,$2); |
|
} |
} |
} |
|
|
return; |
return; |