--- loncom/interface/statistics/lonproblemanalysis.pm 2004/03/01 16:39:19 1.74 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/03/11 19:34:10 1.75 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.74 2004/03/01 16:39:19 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.75 2004/03/11 19:34:10 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,7 +99,7 @@ sub BuildProblemAnalysisPage { } $r->rflush(); # - my $problem_types = '(option|radiobutton|numerical)'; + my $problem_types = '(option|radiobutton)'; if (exists($ENV{'form.problemchoice'}) && ! exists($ENV{'form.SelectAnother'})) { foreach my $button (@SubmitButtons) { @@ -552,7 +552,7 @@ sub OR_tries_analysis { $mintries,$maxtries); my $analysis = ''; if ($ENV{'form.AnalyzeAs'} eq 'Foils') { - $analysis = &OR_Tries_Foil_Analysis($mintries,$maxtries,$Foils, + $analysis = &OR_Tries_Foil_Analysis($mintries,$maxtries,$Concepts, \%ResponseData,$ORdata); } else { $analysis = &OR_Tries_Concept_Analysis($mintries,$maxtries, @@ -563,34 +563,36 @@ sub OR_tries_analysis { } sub OR_Tries_Foil_Analysis { - my ($mintries,$maxtries,$Foils,$respdat,$ORdata) = @_; + my ($mintries,$maxtries,$Concepts,$respdat,$ORdata) = @_; my %ResponseData = %$respdat; # # Compute the data neccessary to make the plots my @PlotData; - foreach my $foilid (@$Foils) { - for (my $i=$mintries;$i<=$maxtries;$i++) { - if ($ResponseData{$foilid}->[$i]->{'_total'} == 0) { - push(@{$PlotData[$i]->{'_correct'}},0); - } else { - push(@{$PlotData[$i]->{'_correct'}}, - 100*$ResponseData{$foilid}->[$i]->{'_correct'}/ - $ResponseData{$foilid}->[$i]->{'_total'}); - } - foreach my $option (@{$ORdata->{'_Options'}}) { - push(@{$PlotData[$i]->{'_total'}}, - $ResponseData{$foilid}->[$i]->{'_total'}); + foreach my $concept (@$Concepts) { + foreach my $foilid (@{$concept->{'foils'}}) { + for (my $i=$mintries;$i<=$maxtries;$i++) { if ($ResponseData{$foilid}->[$i]->{'_total'} == 0) { - push (@{$PlotData[$i]->{$option}},0); + push(@{$PlotData[$i]->{'_correct'}},0); } else { - if ($ResponseData{$foilid}->[$i]->{'_total'} == - $ResponseData{$foilid}->[$i]->{'_correct'}) { - push(@{$PlotData[$i]->{$option}},0); + push(@{$PlotData[$i]->{'_correct'}}, + 100*$ResponseData{$foilid}->[$i]->{'_correct'}/ + $ResponseData{$foilid}->[$i]->{'_total'}); + } + foreach my $option (@{$ORdata->{'_Options'}}) { + push(@{$PlotData[$i]->{'_total'}}, + $ResponseData{$foilid}->[$i]->{'_total'}); + if ($ResponseData{$foilid}->[$i]->{'_total'} == 0) { + push (@{$PlotData[$i]->{$option}},0); } else { - push (@{$PlotData[$i]->{$option}}, + if ($ResponseData{$foilid}->[$i]->{'_total'} == + $ResponseData{$foilid}->[$i]->{'_correct'}) { + push(@{$PlotData[$i]->{$option}},0); + } else { + push (@{$PlotData[$i]->{$option}}, 100 * $ResponseData{$foilid}->[$i]->{$option} / ($ResponseData{$foilid}->[$i]->{'_total'} - $ResponseData{$foilid}->[$i]->{'_correct'})); + } } } } @@ -599,9 +601,9 @@ sub OR_Tries_Foil_Analysis { # # Build a table for the plots my $analysis_html = "
'.$correctgraph.' | '; - ## - ## + + # + # next if (! defined($Datasets[0])); for (my $i=0; $i< scalar(@{$Datasets[0]});$i++) { $Datasets[0]->[$i]=0; } - $count = $ResponseData{'_total'}->[$i]-$ResponseData{'_correct'}->[$i]; + $count = $ResponseData{'_total'}->[$try] - + $ResponseData{'_correct'}->[$try]; if ($count == 0) { $count = 'no submissions'; } elsif ($count == 1) { @@ -633,12 +637,12 @@ sub OR_Tries_Foil_Analysis { } else { $count = $count.' submissions'; } - $title = 'Attempt '.$i.', '.$count; + $title = 'Attempt '.$try.', '.$count; my $incorrectgraph = &Apache::loncommon::DrawBarGraph ($title,'Foil Number','% Option Chosen Incorrectly', 100,$plotcolors,undef,@Datasets); $analysis_html.= ''.$incorrectgraph.' | '; - $analysis_html.= ''.$foilkey." | '.$optionkey." | \n"; } $analysis_html .= " |