--- loncom/interface/statistics/lonproblemanalysis.pm 2004/01/16 15:35:04 1.55 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/01/16 20:19:33 1.56 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.55 2004/01/16 15:35:04 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.56 2004/01/16 20:19:33 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -159,14 +159,11 @@ sub BuildProblemAnalysisPage { '.'. $current_problem->{'respid'}}; if ($current_problem->{'resptype'} eq 'option') { - &OptionResponseAnalysis($r,$resource, - $current_problem->{'respid'}, + &OptionResponseAnalysis($r,$current_problem, $ProblemData, \@Students); } elsif ($current_problem->{'resptype'} eq 'radiobutton') { - &RadioResponseAnalysis($r,$resource, - $current_problem->{'part'}, - $current_problem->{'respid'}, + &RadioResponseAnalysis($r,$current_problem, $ProblemData, \@Students); } else { @@ -183,9 +180,6 @@ sub BuildProblemAnalysisPage { } } -=pod - -Removed code: ######################################################### ######################################################### @@ -195,7 +189,9 @@ Removed code: ######################################################### ######################################################### sub RadioResponseAnalysis { - my ($r,$resource,$part,$respid,$ProblemData,$Students) = @_; + my ($r,$problem,$ProblemData,$Students) = @_; + my ($resource,$respid) = ($problem->{'resource'}, + $problem->{'respid'}); my $analysis_html; my $PerformanceData = &Apache::loncoursedata::get_response_data @@ -209,14 +205,14 @@ sub RadioResponseAnalysis { return; } if (exists($ENV{'form.ExcelOutput'})) { - $analysis_html .= &RR_Excel_output($r,$resource,$PerformanceData, - $ProblemData); + $analysis_html .= &RR_Excel_output($r,$problem->{'resource'}, + $PerformanceData,$ProblemData); } elsif ($ENV{'form.AnalyzeOver'} eq 'Tries') { - $analysis_html .= &RR_Tries_Analysis($r,$resource,$PerformanceData, - $ProblemData); + $analysis_html .= &RR_Tries_Analysis($r,$problem->{'resource'}, + $PerformanceData,$ProblemData); } elsif ($ENV{'form.AnalyzeOver'} eq 'Time') { - $analysis_html .= &RR_Time_Analysis($r,$resource,$PerformanceData, - $ProblemData); + $analysis_html .= &RR_Time_Analysis($r,$problem->{'resource'}, + $PerformanceData,$ProblemData); } else { $analysis_html .= '

'. &mt('The analysis you have selected is not supported at this time'). @@ -225,7 +221,6 @@ sub RadioResponseAnalysis { $r->print($analysis_html); } - sub RR_Excel_output { my ($r,$PerformanceData,$ProblemData) = @_; return '

No!

'; @@ -246,15 +241,15 @@ sub RR_Tries_Analysis { } $analysis_html .= $table; my @TryData = &RR_tries_data_analysis($r,$PerformanceData); - if ($ENV{'form.AnalyzeAs'} eq 'Foils') { - $analysis_html = &RR_Tries_Foil_Analysis($mintries,$maxtries,$Foils, +# if ($ENV{'form.AnalyzeAs'} eq 'Foils') { + $analysis_html .= &RR_Tries_Foil_Analysis($mintries,$maxtries,$Foils, \@TryData,$ProblemData); - } else { - $analysis_html = &RR_Tries_Concept_Analysis($mintries,$maxtries, - $Concepts, - \@TryData, - $ProblemData); - } +# } else { +# $analysis_html = &RR_Tries_Concept_Analysis($mintries,$maxtries, +# $Concepts, +# \@TryData, +# $ProblemData); +# } return $analysis_html; } @@ -284,8 +279,8 @@ sub RR_Tries_Foil_Analysis { my @PlotData_Correct; my @PlotData_Incorrect; next if ($try > scalar(@{$TryData})); - next if (! defined($TryData->[$try-1])); - my %DataSet = %{$TryData->[$try-1]}; + next if (! defined($TryData->[$try])); + my %DataSet = %{$TryData->[$try]}; my $total = 0; foreach my $foilid (@$Foils) { $total += $DataSet{$foilid}; @@ -316,7 +311,6 @@ sub RR_Tries_Foil_Analysis { \@PlotData_Correct, \@PlotData_Incorrect); } - &Apache::lonnet::logthis('plot = '.$html); return $html; } @@ -339,14 +333,12 @@ sub RR_Time_Concept_Analysis { } - sub get_Radio_problem_data { my ($url) = @_; my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze')); (my $garbage,$Answ)=split('_HASH_REF__',$Answ,2); my %Answer = &Apache::lonnet::str2hash($Answ); my %Partdata; - &Apache::lonnet::logthis('url = '.$url); foreach my $part (@{$Answer{'parts'}}) { while (my($key,$value) = each(%Answer)) { # if (ref($value) eq 'ARRAY') { @@ -372,9 +364,6 @@ sub get_Radio_problem_data { return %Partdata; } -=cut - - ######################################################### ######################################################### ## @@ -383,7 +372,10 @@ sub get_Radio_problem_data { ######################################################### ######################################################### sub OptionResponseAnalysis { - my ($r,$resource,$respid,$ProblemData,$Students) = @_; + my ($r,$problem,$ProblemData,$Students) = @_; + my ($resource,$respid) = ($problem->{'resource'}, + $problem->{'respid'}); + # Note: part data is not needed. my $PerformanceData = &Apache::loncoursedata::get_response_data ($Students,$resource->{'symb'},$respid); @@ -1517,8 +1509,8 @@ sub ProblemSelector { for (my $i=0;$i{'ResponseTypes'}});$i++){ my $respid = $partdata->{'ResponseIds'}->[$i]; my $resptype = $partdata->{'ResponseTypes'}->[$i]; - if ($resptype eq 'option' ){ -# if ($resptype eq 'option' || $resptype eq 'radiobutton') { +# if ($resptype eq 'option' ){ + if ($resptype eq 'option' || $resptype eq 'radiobutton') { my $value = &make_target_id({symb=>$res->{'symb'}, part=>$part, respid=>$respid, @@ -1533,7 +1525,8 @@ sub ProblemSelector { } $seq_str .= ''. ''. - ''. + ''. +#.$resptype.''. ''.$title.' '; # ''.$resptype.' '.$res->{'title'}.' '; if ($partdata->{'option'} > 1) { @@ -1594,7 +1587,8 @@ sub get_prev_curr_next { for (my $i=0;$i{'ResponseTypes'}});$i++){ my $respid = $partdata->{'ResponseIds'}->[$i]; my $resptype = $partdata->{'ResponseTypes'}->[$i]; - next if ($resptype ne 'option'); + next if ($resptype ne 'option' && + $resptype ne 'radiobutton'); push (@Resource, { symb => $res->{symb}, part => $part,