--- loncom/interface/statistics/lonproblemanalysis.pm 2004/09/29 14:38:35 1.90 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/10/05 14:03:45 1.93 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.90 2004/09/29 14:38:35 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.93 2004/10/05 14:03:45 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', @@ -618,9 +619,9 @@ sub OR_tries_analysis { foreach my $foilid (@{$concept->{'foils'}}) { for (my $try=$mintries;$try<=$maxtries;$try++) { # concept analysis data - $concept_data[$j]->{'_correct'} += + $concept_data[$j]->[$try]->{'_correct'} += $response_data{$foilid}->[$try]->{'_correct'}; - $concept_data[$j]->{'_total'} += + $concept_data[$j]->[$try]->{'_total'} += $response_data{$foilid}->[$try]->{'_total'}; # # foil analysis data @@ -662,19 +663,32 @@ 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) { # # Create concept plot my @concept_plot_data; for (my $j=0;$j<=$#concept_data;$j++) { - my $total = $concept_data[$j]->{'_total'}; + my $total = $concept_data[$j]->[$try]->{'_total'}; if ($total == 0) { $concept_plot_data[$j] = 0; } else { $concept_plot_data[$j] = 100 * sprintf('%0.3f', - $concept_data[$j]->{'_correct'} / $total); + $concept_data[$j]->[$try]->{'_correct'} / + $total); } } # @@ -830,8 +844,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 +942,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 +964,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 +977,7 @@ sub OR_Foil_Time_Analysis { 100, $plotcolors, undef, - @plotdata); - + @plotdata); return ($correct_plot,$incorrect_plot); } @@ -1376,6 +1396,17 @@ sub CreateInterface { ## ## $Str .= ''; + ## + my $showprob_checkbox = + '
'; + ## my $analyze_selector = ''; - $Str .= ''. + $Str .= '
'.$/; + '
'.$/; ## my $numplots_selector = '