--- loncom/interface/statistics/lonproblemanalysis.pm 2003/10/16 13:23:13 1.40 +++ loncom/interface/statistics/lonproblemanalysis.pm 2003/10/16 15:24:49 1.41 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.40 2003/10/16 13:23:13 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.41 2003/10/16 15:24:49 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,7 +49,8 @@ sub BuildProblemAnalysisPage { # my @Students = @Apache::lonstatistics::Students; # - if (exists($ENV{'form.updatecaches'}) || + if (exists($ENV{'form.ClearCache'}) || + exists($ENV{'form.updatecaches'}) || (exists($ENV{'form.firstanalysis'}) && $ENV{'form.firstanalysis'} ne 'no')) { &Apache::lonstatistics::Gather_Full_Student_Data($r); @@ -85,6 +86,7 @@ sub BuildProblemAnalysisPage { # my $resource = &get_resource_from_symb($symb); if (defined($resource)) { + $r->print('

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

'); my %Data = &get_problem_data($resource->{'src'}); my $ORdata = $Data{$part.'.'.$resid}; ## @@ -149,6 +151,7 @@ sub BuildProblemAnalysisPage { ######################################################### sub build_foil_index { my ($ORdata) = @_; + return if (! exists($ORdata->{'Foils'})); my %Foildata = %{$ORdata->{'Foils'}}; my @Foils = sort(keys(%Foildata)); my %Concepts; @@ -264,7 +267,7 @@ sub build_option_index { my $table = "\n"; my $optionindex = 0; my @Rows; - foreach my $option ('correct',@{$ORdata->{'Options'}}) { + foreach my $option (&mt('correct option chosen'),@{$ORdata->{'Options'}}) { push (@Rows, ''. '
'. @@ -307,7 +310,7 @@ sub tries_analysis { if ($ENV{'form.AnalyzeAs'} eq 'Foils') { $extrakey = &build_option_index($ORdata); $xlabel = 'Foil Number'; - $ylabel = 'Option Chosen'; + $ylabel = 'Percent Choosing Option'; foreach my $foilid (@$Foils) { for (my $i=$mintries;$i<=$maxtries;$i++) { foreach my $option ('_correct',@{$ORdata->{'Options'}}) { @@ -415,8 +418,7 @@ sub analyze_option_data_by_tries { for (my $i=0;$i<=$#Foilgrades;$i++) { my ($foilid,$correct) = split('=',$Foilgrades[$i]); my (undef,$submission) = split('=',$Foilsubs[$i]); - $submission = &HTML::Entities::decode($submission); - $submission =~ s/\%20/ /g; + $submission = &Apache::lonnet::unescape($submission); if ($correct) { $Trydata{$foilid}->[$numtries]->{'_correct'}++; } else { @@ -765,30 +767,23 @@ sub get_problem_data { $key =~ s/^$part\.//; if (ref($value) eq 'ARRAY') { if ($key eq 'options') { - for(my $i=0;$i[$i]=~ s/(\s*$|^\s*)//g; - } $Partdata{$part}->{'Options'}=$value; } elsif ($key eq 'concepts') { $Partdata{$part}->{'Concepts'}=$value; } elsif ($key =~ /^concept\.(.*)$/) { my $concept = $1; foreach my $foil (@$value) { - $foil =~ s/(\s*$|^\s*)//g; $Partdata{$part}->{'Foils'}->{$foil}->{'Concept'}= $concept; } } } else { - $value =~ s/(\s*$|^\s*)//g; if ($key=~ /^foil\.text\.(.*)$/) { my $foil = $1; - $foil =~ s/(\s*$|^\s*)//g; $Partdata{$part}->{'Foils'}->{$foil}->{'name'}=$foil; $Partdata{$part}->{'Foils'}->{$foil}->{'text'}=$value; } elsif ($key =~ /^foil\.value\.(.*)$/) { my $foil = $1; - $foil =~ s/(\s*$|^\s*)//g; $Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; } }