Diff for /loncom/interface/lonmeta.pm between versions 1.72 and 1.73

version 1.72, 2004/04/15 18:06:29 version 1.73, 2004/04/16 21:43:56
Line 193  sub fieldnames { Line 193  sub fieldnames {
          'technical'  => 'Resource is technically correct',            'technical'  => 'Resource is technically correct', 
          'avetries'   => 'Average number of tries till solved',           'avetries'   => 'Average number of tries till solved',
          'stdno'      => 'Total number of students who have worked on this problem',           'stdno'      => 'Total number of students who have worked on this problem',
          'difficulty' => 'Degree of difficulty'           'difficulty' => 'Degree of difficulty',
            'disc'       => 'Degree of discrimination',
          );           );
 }  }
   
Line 283  sub prettyprint { Line 284  sub prettyprint {
  return &evalgraph($value);   return &evalgraph($value);
     }      }
     # Difficulty      # Difficulty
     if ($type eq 'difficulty') {      if ($type eq 'difficulty' || $type eq 'disc') {
  return &diffgraph($value);   return &diffgraph($value);
     }      }
     # List of courses      # List of courses
Line 589  sub print_dynamic_metadata { Line 590  sub print_dynamic_metadata {
     $r->rflush();      $r->rflush();
     my %items=&fieldnames();      my %items=&fieldnames();
     my %dynmeta=&dynamicmeta($uri);      my %dynmeta=&dynamicmeta($uri);
       &Apache::lonnet::logthis('dynamic metadata keys:'.$/.
                                join("\n",keys(%dynmeta)));
     #      #
     # General Access and Usage Statistics      # General Access and Usage Statistics
     if (exists($dynmeta{'count'}) ||      if (exists($dynmeta{'count'}) ||
Line 613  sub print_dynamic_metadata { Line 616  sub print_dynamic_metadata {
     }      }
     #      #
     # Assessment statistics      # Assessment statistics
     if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/ &&      if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) {
         (exists($dynmeta{'stdno'}) ||          if (exists($dynmeta{'stdno'}) ||
          exists($dynmeta{'avetries'}) ||              exists($dynmeta{'avetries'}) ||
          exists($dynmeta{'difficulty'}))) {              exists($dynmeta{'difficulty'}) ||
         # This is an assessment, print assessment data              exists($dynmeta{'disc'})) {
         $r->print('<h4>'.&mt('Assessment Statistical Data').'</h4>'.              # This is an assessment, print assessment data
                   '<table cellspacing=2 border=0>');              $r->print('<h4>'.
         foreach ('stdno','avetries','difficulty') {                        &mt('Overall Assessment Statistical Data').
             $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'.                        '</h4>'.
                         '<table cellspacing=2 border=0>');
               $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{'stdno'}.'</td>'.
                       '<td bgcolor="#CCCCCC">'.                        '<td bgcolor="#CCCCCC">'.
                       &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).'</td>'.                        &prettyprint('stdno',$dynmeta{'stdno'}).
                       "</tr>\n");                        '</td>'."</tr>\n");
               foreach ('avetries','difficulty','disc') {
                   $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'.
                             '<td bgcolor="#CCCCCC">'.
                             &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).
                             '</td>'."</tr>\n");
               }
               $r->print('</table>');    
           }
           if (exists($dynmeta{'stats'})) {
               #
               # New assessment statistics
               $r->print('<h4>'.
                         &mt('Detailed Assessment Statistical Data').
                         '</h4>');
               my $table = '<table cellspacing=2 border=0>'.
                   '<tr>'.
                   '<th>Course</th>'.
                   '<th>Section(s)</th>'.
                   '<th>Num Students</th>'.
                   '<th>Mean Tries</th>'.
                   '<th>Degree of Difficulty</th>'.
                   '<th>Degree of Discrimination</th>'.
                   '<th>Time of computation</th>'.
                   '</tr>'.$/;
               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 .= '<tr>';
                   $table .= 
                       '<td><nobr>'.$courseinfo{'description'}.'</nobr></td>';
                   $table .= 
                       '<td align="right">'.$data->{'sections'}.'</td>';
                   $table .=
                       '<td align="right">'.$data->{'stdno'}.'</td>';
                   foreach ('avetries','difficulty','disc') {
                       $table .= '<td align="right">';
                       if (exists($data->{$_})) {
                           $table .= sprintf('%.2f',$data->{$_}).'&nbsp;';
                       } else {
                           $table .= '';
                       }
                       $table .= '</td>';
                   }
                   $table .=
                       '<td><nobr>'.
                       &Apache::lonlocal::locallocaltime($data->{'timestamp'}).
                       '</nobr></td>';
                   $table .=
                       '</tr>'.$/;
               }
               $table .= '</table>'.$/;
               $r->print($table);
           } else {
               $r->print('No new dynamic data found.');
         }          }
         $r->print('</table>');      
     } else {      } else {
         $r->print('<h4>'.&mt('No Assessment Statistical Data is available for this resource').'</h4>');          $r->print('<h4>'.
             &mt('No Assessment Statistical Data is available for this resource').
                     '</h4>');
     }      }
   
       #
       #
     if (exists($dynmeta{'clear'})   ||       if (exists($dynmeta{'clear'})   || 
         exists($dynmeta{'depth'})   ||           exists($dynmeta{'depth'})   || 
         exists($dynmeta{'helpful'}) ||           exists($dynmeta{'helpful'}) || 

Removed from v.1.72  
changed lines
  Added in v.1.73


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>