Diff for /loncom/interface/statistics/lonproblemanalysis.pm between versions 1.90 and 1.93

version 1.90, 2004/09/29 14:38:35 version 1.93, 2004/10/05 14:03:45
Line 56  my @SubmitButtons = ({ name => 'PrevProb Line 56  my @SubmitButtons = ({ name => 'PrevProb
                      { name => 'ExcelOutput',                       { name => 'ExcelOutput',
                        text => 'Produce Excel Output' });                         text => 'Produce Excel Output' });
   
   
 sub BuildProblemAnalysisPage {  sub BuildProblemAnalysisPage {
     my ($r,$c)=@_;      my ($r,$c)=@_;
     #      #
Line 135  sub BuildProblemAnalysisPage { Line 134  sub BuildProblemAnalysisPage {
             my $resource = $current_problem->{'resource'};              my $resource = $current_problem->{'resource'};
             $r->print('<h1>'.$resource->{'title'}.'</h1>');              $r->print('<h1>'.$resource->{'title'}.'</h1>');
             $r->print('<h3>'.$resource->{'src'}.'</h3>');              $r->print('<h3>'.$resource->{'src'}.'</h3>');
             $r->print(&Apache::lonstathelpers::render_resource($resource));              if ($ENV{'form.show_prob'} eq 'true') {
                   $r->print(&Apache::lonstathelpers::render_resource($resource));
               }
             $r->rflush();              $r->rflush();
             my %Data = &Apache::lonstathelpers::get_problem_data              my %Data = &Apache::lonstathelpers::get_problem_data
                 ($resource->{'src'});                  ($resource->{'src'});
Line 404  sub RadioResponseAnalysis { Line 405  sub RadioResponseAnalysis {
     } else {      } else {
         $analysis_html .= '<h2>'.          $analysis_html .= '<h2>'.
            &mt('The analysis you have selected is not supported at this time').             &mt('The analysis you have selected is not supported at this time').
            '</h2>';              '</h2>';
     }      }
     $r->print($analysis_html);      $r->print($analysis_html);
 }  }
Line 481  sub RR_Tries_Foil_Analysis { Line 482  sub RR_Tries_Foil_Analysis {
                 }                  }
             }              }
         }          }
         my $title='Attempt '.$try;          my $title='Attempt '.$try.' (N='.$total.')';
         my $xlabel = $total.' Submissions';          my $xlabel = 'Foil Chosen';
         $html.=  &Apache::loncommon::DrawBarGraph($title,          $html.=  &Apache::loncommon::DrawBarGraph($title,
                                                   $xlabel,                                                    $xlabel,
                                                   'Percent Choosing',                                                    'Percent Choosing',
Line 618  sub OR_tries_analysis { Line 619  sub OR_tries_analysis {
         foreach my $foilid (@{$concept->{'foils'}}) {          foreach my $foilid (@{$concept->{'foils'}}) {
             for (my $try=$mintries;$try<=$maxtries;$try++) {              for (my $try=$mintries;$try<=$maxtries;$try++) {
                 # concept analysis data                  # concept analysis data
                 $concept_data[$j]->{'_correct'} +=                  $concept_data[$j]->[$try]->{'_correct'} +=
                     $response_data{$foilid}->[$try]->{'_correct'};                      $response_data{$foilid}->[$try]->{'_correct'};
                 $concept_data[$j]->{'_total'} +=                  $concept_data[$j]->[$try]->{'_total'} +=
                     $response_data{$foilid}->[$try]->{'_total'};                      $response_data{$foilid}->[$try]->{'_total'};
                 #                  #
                 # foil analysis data                  # foil analysis data
Line 662  sub OR_tries_analysis { Line 663  sub OR_tries_analysis {
     if (defined($Concepts)) { $num_concepts = scalar(@$Concepts); }      if (defined($Concepts)) { $num_concepts = scalar(@$Concepts); }
     #      #
     for (my $try=$mintries;$try<=$maxtries;$try++) {      for (my $try=$mintries;$try<=$maxtries;$try++) {
           if (! defined($response_data{'_total'}->[$try]) ||
               $response_data{'_total'}->[$try] == 0) { 
               if ($try > 1) {
                   $analysis_html.= '<tr><td align="center" colspan="4"><b>'.
                       &mt('None of the selected students attempted the problem more than [_1] times.',$try-1).
                       '</b></td></tr>';
               } else {
                   $analysis_html.= '<tr><td colspan="4" align="center"><b>'.
                       &mt('None of the selected students have attempted the problem').'</b></td></tr>';
               }
               last;
           }
         my $concept_graph='';          my $concept_graph='';
         if ($num_concepts > 1) {          if ($num_concepts > 1) {
             #              #
             # Create concept plot              # Create concept plot
             my @concept_plot_data;              my @concept_plot_data;
             for (my $j=0;$j<=$#concept_data;$j++) {              for (my $j=0;$j<=$#concept_data;$j++) {
                 my $total = $concept_data[$j]->{'_total'};                  my $total = $concept_data[$j]->[$try]->{'_total'};
                 if ($total == 0) {                  if ($total == 0) {
                     $concept_plot_data[$j] = 0;                      $concept_plot_data[$j] = 0;
                 } else {                  } else {
                     $concept_plot_data[$j] = 100 *                       $concept_plot_data[$j] = 100 * 
                         sprintf('%0.3f',                          sprintf('%0.3f',
                                 $concept_data[$j]->{'_correct'} / $total);                                  $concept_data[$j]->[$try]->{'_correct'} / 
                                   $total);
                 }                  }
             }              }
             #              #
Line 830  sub OR_time_analysis { Line 844  sub OR_time_analysis {
                                                               > $starttime);                                                                > $starttime);
         }          }
         $begin_index = $j;          $begin_index = $j;
         while (++$j < scalar(@$performance_data)) {          while ($j < scalar(@$performance_data)) {
             last if (&get_time_from_row($performance_data->[$j]) > $endtime);              if (&get_time_from_row($performance_data->[$j]) > $endtime) {
                   last;
               } else {
                   $j++;
               }
         }          }
         $end_index = $j;          $end_index = $j;
         ##          ##
Line 924  sub OR_Foil_Time_Analysis { Line 942  sub OR_Foil_Time_Analysis {
     #      #
     # Create the plot      # Create the plot
     my $count = $end_index-$begin_index;      my $count = $end_index-$begin_index;
       return ('No data','') if ($count <= 0);
     my $title;      my $title;
     if ($count == 0) {      if ($count == 0) {
         $title = 'no submissions';          $title = 'no submissions';
     } elsif ($count == 1) {      } elsif ($count == 1) {
         $title = 'one submission';          $title = 'one submission';
     } else {      } elsif ($count > 1) {
         $title = $count.' submissions';          $title = $count.' submissions';
     }      }
     my $correct_plot = &Apache::loncommon::DrawBarGraph($title,      my $correct_plot = &Apache::loncommon::DrawBarGraph($title,
Line 945  sub OR_Foil_Time_Analysis { Line 964  sub OR_Foil_Time_Analysis {
     $count = $end_index-$begin_index-$TimeData{'_correct'};      $count = $end_index-$begin_index-$TimeData{'_correct'};
     if ($count == 0) {      if ($count == 0) {
         $title = 'no submissions';          $title = 'no submissions';
       } elsif ($count < 0) {
           return ($correct_plot,'');
     } elsif ($count == 1) {      } elsif ($count == 1) {
         $title = 'one submission';          $title = 'one submission';
     } else {      } else {
Line 956  sub OR_Foil_Time_Analysis { Line 977  sub OR_Foil_Time_Analysis {
                                                  100,                                                   100,
                                                  $plotcolors,                                                   $plotcolors,
                                                  undef,                                                   undef,
                                                  @plotdata);                                                           @plotdata);
   
     return ($correct_plot,$incorrect_plot);      return ($correct_plot,$incorrect_plot);
 }  }
   
Line 1376  sub CreateInterface { Line 1396  sub CreateInterface {
     ##      ##
     ##      ##
     $Str .= '<td>';      $Str .= '<td>';
       ##
       my $showprob_checkbox = 
           '<input type="checkbox" name="show_prob" value="true" ';
       if ($ENV{'form.show_prob'} eq 'true') {
           $showprob_checkbox .= 'checked ';
       }
       $showprob_checkbox.= ' />';
       $Str.= '<nobr><label>'.
           &mt('Show problem [_1]',$showprob_checkbox).
           '</label></nobr><br />';
       ##
     my $analyze_selector = '<select name="AnalyzeOver" >';      my $analyze_selector = '<select name="AnalyzeOver" >';
     $analyze_selector .= '<option value="Tries" ';      $analyze_selector .= '<option value="Tries" ';
     if (! exists($ENV{'form.AnalyzeOver'}) ||       if (! exists($ENV{'form.AnalyzeOver'}) || 
Line 1388  sub CreateInterface { Line 1419  sub CreateInterface {
     $analyze_selector .= ' selected ' if ($ENV{'form.AnalyzeOver'} eq 'Time');      $analyze_selector .= ' selected ' if ($ENV{'form.AnalyzeOver'} eq 'Time');
     $analyze_selector .= '>'.&mt('Time').'</option>';      $analyze_selector .= '>'.&mt('Time').'</option>';
     $analyze_selector .= '</select>';      $analyze_selector .= '</select>';
     $Str .= '<nobr>'.      $Str .= '<nobr><label>'.
         &mt('Analyze Over [_1] [_2]',          &mt('Analyze Over [_1] [_2]',
             $analyze_selector,              $analyze_selector,
             &Apache::loncommon::help_open_topic('Analysis_Analyze_Over')).              &Apache::loncommon::help_open_topic('Analysis_Analyze_Over')).
             '</nobr><br />'.$/;              '</label></nobr><br />'.$/;
     ##      ##
     my $numplots_selector = '<select name="NumPlots">';      my $numplots_selector = '<select name="NumPlots">';
     if (! exists($ENV{'form.NumPlots'})       if (! exists($ENV{'form.NumPlots'}) 

Removed from v.1.90  
changed lines
  Added in v.1.93


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