--- loncom/interface/statistics/lonproblemanalysis.pm 2004/09/28 20:41:58 1.88 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/10/04 19:49:41 1.92 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.88 2004/09/28 20:41:58 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.92 2004/10/04 19:49:41 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -56,7 +56,6 @@ my @SubmitButtons = ({ name => 'PrevProb { name => 'ExcelOutput', text => 'Produce Excel Output' }); - sub BuildProblemAnalysisPage { my ($r,$c)=@_; # @@ -135,7 +134,9 @@ sub BuildProblemAnalysisPage { my $resource = $current_problem->{'resource'}; $r->print('

'.$resource->{'title'}.'

'); $r->print('

'.$resource->{'src'}.'

'); - $r->print(&Apache::lonstathelpers::render_resource($resource)); + if ($ENV{'form.show_prob'} eq 'true') { + $r->print(&Apache::lonstathelpers::render_resource($resource)); + } $r->rflush(); my %Data = &Apache::lonstathelpers::get_problem_data ($resource->{'src'}); @@ -404,7 +405,7 @@ sub RadioResponseAnalysis { } else { $analysis_html .= '

'. &mt('The analysis you have selected is not supported at this time'). - '

'; + ''; } $r->print($analysis_html); } @@ -481,8 +482,8 @@ sub RR_Tries_Foil_Analysis { } } } - my $title='Attempt '.$try; - my $xlabel = $total.' Submissions'; + my $title='Attempt '.$try.' (N='.$total.')'; + my $xlabel = 'Foil Chosen'; $html.= &Apache::loncommon::DrawBarGraph($title, $xlabel, 'Percent Choosing', @@ -662,6 +663,18 @@ sub OR_tries_analysis { if (defined($Concepts)) { $num_concepts = scalar(@$Concepts); } # for (my $try=$mintries;$try<=$maxtries;$try++) { + if (! defined($response_data{'_total'}->[$try]) || + $response_data{'_total'}->[$try] == 0) { + if ($try > 1) { + $analysis_html.= ''. + &mt('None of the selected students attempted the problem more than [_1] times.',$try-1). + ''; + } else { + $analysis_html.= ''. + &mt('None of the selected students have attempted the problem').''; + } + last; + } my $concept_graph=''; if ($num_concepts > 1) { # @@ -830,8 +843,12 @@ sub OR_time_analysis { > $starttime); } $begin_index = $j; - while (++$j < scalar(@$performance_data)) { - last if (&get_time_from_row($performance_data->[$j]) > $endtime); + while ($j < scalar(@$performance_data)) { + if (&get_time_from_row($performance_data->[$j]) > $endtime) { + last; + } else { + $j++; + } } $end_index = $j; ## @@ -924,12 +941,13 @@ sub OR_Foil_Time_Analysis { # # Create the plot my $count = $end_index-$begin_index; + return ('No data','') if ($count <= 0); my $title; if ($count == 0) { $title = 'no submissions'; } elsif ($count == 1) { $title = 'one submission'; - } else { + } elsif ($count > 1) { $title = $count.' submissions'; } my $correct_plot = &Apache::loncommon::DrawBarGraph($title, @@ -945,6 +963,8 @@ sub OR_Foil_Time_Analysis { $count = $end_index-$begin_index-$TimeData{'_correct'}; if ($count == 0) { $title = 'no submissions'; + } elsif ($count < 0) { + return ($correct_plot,''); } elsif ($count == 1) { $title = 'one submission'; } else { @@ -956,8 +976,7 @@ sub OR_Foil_Time_Analysis { 100, $plotcolors, undef, - @plotdata); - + @plotdata); return ($correct_plot,$incorrect_plot); } @@ -1376,50 +1395,55 @@ sub CreateInterface { ## ## $Str .= ''; - { # These braces are here to organize the code, not scope it. - { - $Str .= ''.&mt('Analyze Over '); - $Str .= &Apache::loncommon::help_open_topic - ('Analysis_Analyze_Over'); - $Str .=''; - $Str .= '
'; - } - { - $Str .= ''.&mt('Number of Plots:'); - $Str .= &Apache::loncommon::help_open_topic - ('Analysis_num_plots'); - $Str .= '
'; - } - { - $Str .= ''.&mt('Status: [_1]', + ## + my $showprob_checkbox = + '
'; + ## + my $analyze_selector = ''; + $Str .= '
'.$/; + ## + my $numplots_selector = '
'; + $Str .= ''; + ## + $Str .= '
'; - } - } + ''; $Str .= ''; ## ##