--- loncom/interface/lonmeta.pm 2004/04/15 18:06:29 1.72 +++ loncom/interface/lonmeta.pm 2004/04/16 21:43:56 1.73 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.72 2004/04/15 18:06:29 matthew Exp $ +# $Id: lonmeta.pm,v 1.73 2004/04/16 21:43:56 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -193,7 +193,8 @@ sub fieldnames { 'technical' => 'Resource is technically correct', 'avetries' => 'Average number of tries till solved', 'stdno' => 'Total number of students who have worked on this problem', - 'difficulty' => 'Degree of difficulty' + 'difficulty' => 'Degree of difficulty', + 'disc' => 'Degree of discrimination', ); } @@ -283,7 +284,7 @@ sub prettyprint { return &evalgraph($value); } # Difficulty - if ($type eq 'difficulty') { + if ($type eq 'difficulty' || $type eq 'disc') { return &diffgraph($value); } # List of courses @@ -589,6 +590,8 @@ sub print_dynamic_metadata { $r->rflush(); my %items=&fieldnames(); my %dynmeta=&dynamicmeta($uri); + &Apache::lonnet::logthis('dynamic metadata keys:'.$/. + join("\n",keys(%dynmeta))); # # General Access and Usage Statistics if (exists($dynmeta{'count'}) || @@ -613,23 +616,88 @@ sub print_dynamic_metadata { } # # Assessment statistics - if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/ && - (exists($dynmeta{'stdno'}) || - exists($dynmeta{'avetries'}) || - exists($dynmeta{'difficulty'}))) { - # This is an assessment, print assessment data - $r->print('

'.&mt('Assessment Statistical Data').'

'. - ''); - foreach ('stdno','avetries','difficulty') { - $r->print(''. + if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if (exists($dynmeta{'stdno'}) || + exists($dynmeta{'avetries'}) || + exists($dynmeta{'difficulty'}) || + exists($dynmeta{'disc'})) { + # This is an assessment, print assessment data + $r->print('

'. + &mt('Overall Assessment Statistical Data'). + '

'. + '
'.$lt{$_}.'
'); + $r->print(''. ''. - "\n"); + &prettyprint('stdno',$dynmeta{'stdno'}). + ''."\n"); + foreach ('avetries','difficulty','disc') { + $r->print(''. + ''."\n"); + } + $r->print('
'.$lt{'stdno'}.''. - &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).'
'.$lt{$_}.''. + &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})). + '
'); + } + if (exists($dynmeta{'stats'})) { + # + # New assessment statistics + $r->print('

'. + &mt('Detailed Assessment Statistical Data'). + '

'); + my $table = ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''.$/; + foreach my $identifier (sort(keys(%{$dynmeta{'stats'}}))) { + my $data = $dynmeta{'stats'}->{$identifier}; + my $course = $data->{'course'}; + my %courseinfo = &Apache::lonnet::coursedescription($course); + if (! exists($courseinfo{'num'}) || $courseinfo{'num'} eq '') { + &Apache::lonnet::logthis('lookup for '.$course.' failed'); + next; + } + $table .= ''; + $table .= + ''; + $table .= + ''; + $table .= + ''; + foreach ('avetries','difficulty','disc') { + $table .= ''; + } + $table .= + ''; + $table .= + ''.$/; + } + $table .= '
CourseSection(s)Num StudentsMean TriesDegree of DifficultyDegree of DiscriminationTime of computation
'.$courseinfo{'description'}.''.$data->{'sections'}.''.$data->{'stdno'}.''; + if (exists($data->{$_})) { + $table .= sprintf('%.2f',$data->{$_}).' '; + } else { + $table .= ''; + } + $table .= ''. + &Apache::lonlocal::locallocaltime($data->{'timestamp'}). + '
'.$/; + $r->print($table); + } else { + $r->print('No new dynamic data found.'); } - $r->print(''); } else { - $r->print('

'.&mt('No Assessment Statistical Data is available for this resource').'

'); + $r->print('

'. + &mt('No Assessment Statistical Data is available for this resource'). + '

'); } + + # + # if (exists($dynmeta{'clear'}) || exists($dynmeta{'depth'}) || exists($dynmeta{'helpful'}) ||