Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.85 and 1.91

version 1.85, 2004/05/14 20:30:17 version 1.91, 2004/07/22 15:56:41
Line 263  my @Fields = ( Line 263  my @Fields = (
              graphable => 'yes',               graphable => 'yes',
              long_title => 'Degree of Discrimination',               long_title => 'Degree of Discrimination',
              selectable => 'yes',               selectable => 'yes',
              defaultselected => 'no',               defaultselected => 'yes',
            },             },
 ##   duedate included for research purposes.  Commented out most of the time.  ##   duedate included for research purposes.  Commented out most of the time.
 #           { name => 'duedate',  #           { name => 'duedate',
Line 298  my @Fields = ( Line 298  my @Fields = (
 #             selectable => 'no',  #             selectable => 'no',
 #             defaultselected => 'yes',  #             defaultselected => 'yes',
 #            },  #            },
   ##   resptypes included for research purposes.  Commented out most of the time.
   #           { name => 'resptypes',
   #             title => 'Response Types',
   #             align => 'left',
   #             color => '#FFFFFF',
   #             sortable => 'no',
   #             graphable => 'no',
   #             long_title => 'Response Types used in this problem',
   #             selectable => 'no',
   #             defaultselected => 'yes',
   #            },
 );  );
   
 my @SeqFields = (  my @SeqFields = (
Line 536  select sections, maps, and output. Line 547  select sections, maps, and output.
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub CreateInterface {  sub CreateInterface {
       my ($r) = @_;
     #      #
     &parse_field_selection();      &parse_field_selection();
     #      #
Line 571  sub CreateInterface { Line 583  sub CreateInterface {
     $Str .= '</td><td>'.&field_selection_input();      $Str .= '</td><td>'.&field_selection_input();
     $Str .= '</td></tr>'."\n";      $Str .= '</td></tr>'."\n";
     $Str .= '</table>'."\n";      $Str .= '</table>'."\n";
       #
       $Str .= '<p>'.&mt('Status: [_1]',
                            '<input type="text" '.
                            'name="stats_status" size="60" value="" />'
                            ).
                            '</nobr></p>';
       #
     $Str .= '<input type="submit" name="GenerateStatistics" value="'.      $Str .= '<input type="submit" name="GenerateStatistics" value="'.
         &mt('Generate Statistics').'" />';          &mt('Generate Statistics').'" />';
     $Str .= '&nbsp;'x5;      $Str .= '&nbsp;'x5;
     $Str .= 'Plot '.&plot_dropdown().('&nbsp;'x10);      $Str .= 'Plot '.&plot_dropdown().('&nbsp;'x10);
     $Str .= '<input type="submit" name="ClearCache" value="'.      #
         &mt('Clear Caches').'" />';  
     $Str .= '&nbsp;'x5;  
     $Str .= '<input type="submit" name="UpdateCache" value="'.  
         &mt('Update Student Data').'" />';  
     $Str .= '&nbsp;'x5;  
     $Str .= '<input type="submit" name="Excel" value="'.  
         &mt('Produce Excel Output').'" />';  
     $Str .= '&nbsp;'x5;  
     return $Str;      return $Str;
 }  }
   
Line 621  sub BuildProblemStatisticsPage { Line 632  sub BuildProblemStatisticsPage {
     undef(%SeqStat);      undef(%SeqStat);
     #      #
     # Finally let the user know we are here      # Finally let the user know we are here
     my $interface = &CreateInterface();      my $interface = &CreateInterface($r);
     $r->print($interface);      $r->print($interface);
     $r->print('<input type="hidden" name="sortby" value="'.$ENV{'form.sortby'}.      $r->print('<input type="hidden" name="sortby" value="'.$ENV{'form.sortby'}.
               '" />');                '" />');
     #      #
     if (! exists($ENV{'form.statsfirstcall'})) {      my @CacheButtonHTML = 
         $r->print('<input type="hidden" name="statsfirstcall" value="yes" />');          &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
       my $Str;
       foreach my $html (@CacheButtonHTML) {
           $Str.=$html.('&nbsp;'x5);
       }
       #
       $r->print($Str);
       if (! exists($ENV{'form.firstrun'})) {
         $r->print('<h3>'.          $r->print('<h3>'.
                   &mt('Press "Generate Statistics" when you are ready.').                    &mt('Press "Generate Statistics" when you are ready.').
                   '</h3><p>'.                    '</h3><p>'.
Line 636  sub BuildProblemStatisticsPage { Line 654  sub BuildProblemStatisticsPage {
                       ' will not have this delay.').                        ' will not have this delay.').
                   '</p>');                    '</p>');
         return;          return;
     } elsif ($ENV{'form.statsfirstcall'} eq 'yes' ||   
              exists($ENV{'form.UpdateCache'}) ||  
              exists($ENV{'form.ClearCache'}) ) {  
         $r->print('<input type="hidden" name="statsfirstcall" value="no" />');  
         &Apache::lonstatistics::Gather_Student_Data($r);  
     } else {  
         $r->print('<input type="hidden" name="statsfirstcall" value="no" />');  
     }      }
     $r->rflush();      $r->rflush();
     #      #
Line 652  sub BuildProblemStatisticsPage { Line 663  sub BuildProblemStatisticsPage {
     #      #
     if (exists($ENV{'form.Excel'})) {      if (exists($ENV{'form.Excel'})) {
         &Excel_output($r);          &Excel_output($r);
     } else {      } else { 
           $r->print('<input type="submit" name="Excel" value="'.
                     &mt('Produce Excel Output').'" />'.'&nbsp;'x5);
           $r->rflush();
         my $count = 0;          my $count = 0;
         foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {          foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
             $count += $seq->{'num_assess_parts'};              $count += $seq->{'num_assess_parts'};
Line 690  sub BuildProblemStatisticsPage { Line 704  sub BuildProblemStatisticsPage {
 sub output_sequence_statistics {  sub output_sequence_statistics {
     my ($r) = @_;      my ($r) = @_;
     my $c=$r->connection();      my $c=$r->connection();
     $r->print('<h2>'.&mt('Sequence Statistics').'</h2>');      $r->print('<h2>'.&mt('Sequence Statistics').
         &Apache::loncommon::help_open_topic('Statistics_Sequence').
         '</h2>');
     $r->print('<table border="0"><tr><td bgcolor="#777777">'."\n".      $r->print('<table border="0"><tr><td bgcolor="#777777">'."\n".
               '<table border="0" cellpadding="3">'."\n".                '<table border="0" cellpadding="3">'."\n".
               '<tr bgcolor="#FFFFE6">');                '<tr bgcolor="#FFFFE6">');
Line 1373  sub compute_statistics_on_sequence { Line 1389  sub compute_statistics_on_sequence {
     foreach my $res (@{$seq->{'contents'}}) {      foreach my $res (@{$seq->{'contents'}}) {
         next if ($res->{'type'} ne 'assessment');          next if ($res->{'type'} ne 'assessment');
         foreach my $part (@{$res->{'parts'}}) {          foreach my $part (@{$res->{'parts'}}) {
               next if ($res->{'partdata'}->{$part}->{'Survey'});
             #              #
             # This is where all the work happens              # This is where all the work happens
             my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1);              my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1);
Line 1519  sub get_statistics { Line 1536  sub get_statistics {
 #        &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb);  #        &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb);
 #    $data->{'opendate'} =   #    $data->{'opendate'} = 
 #        &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb);  #        &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb);
   #    $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}});
     return $data;      return $data;
 }  }
   
Line 1563  sub compute_discrimination_factor { Line 1581  sub compute_discrimination_factor {
         map {           map { 
             $_->[&Apache::loncoursedata::RNK_student()];               $_->[&Apache::loncoursedata::RNK_student()]; 
           } @{$ranking}[($num_students-$number_to_grab)..($num_students-1)];            } @{$ranking}[($num_students-$number_to_grab)..($num_students-1)];
       if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') ||
           ! @TopSet    || (@TopSet    == 1 && $TopSet[0]    eq '')) {
           return 'nan';
       }
     my ($bottom_sum,$bottom_max) =       my ($bottom_sum,$bottom_max) = 
         &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet,          &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet,
                                                   undef,$starttime,$endtime);                                                    undef,$starttime,$endtime);

Removed from v.1.85  
changed lines
  Added in v.1.91


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