version 1.39, 2003/10/15 21:30:51
|
version 1.41, 2003/10/16 15:24:49
|
Line 37 use Apache::lonstatistics;
|
Line 37 use Apache::lonstatistics;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use HTML::Entities(); |
use HTML::Entities(); |
|
|
my $plotcolors = [qw/ |
my $plotcolors = ['#33ff00', |
#33ff00 |
'#0033cc', '#990000', '#aaaa66', '#663399', '#ff9933', |
#0033cc #990000 #aaaa66 #663399 #ff9933 |
'#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66', |
#66ccff #ff9999 #cccc33 #660000 #33cc66 |
]; |
/]; |
|
#[qw/lgreen dgreen dred/]; |
|
|
|
sub BuildProblemAnalysisPage { |
sub BuildProblemAnalysisPage { |
my ($r,$c)=@_; |
my ($r,$c)=@_; |
Line 51 sub BuildProblemAnalysisPage {
|
Line 49 sub BuildProblemAnalysisPage {
|
# |
# |
my @Students = @Apache::lonstatistics::Students; |
my @Students = @Apache::lonstatistics::Students; |
# |
# |
if (exists($ENV{'form.updatecaches'}) || |
if (exists($ENV{'form.ClearCache'}) || |
|
exists($ENV{'form.updatecaches'}) || |
(exists($ENV{'form.firstanalysis'}) && |
(exists($ENV{'form.firstanalysis'}) && |
$ENV{'form.firstanalysis'} ne 'no')) { |
$ENV{'form.firstanalysis'} ne 'no')) { |
&Apache::lonstatistics::Gather_Full_Student_Data($r); |
&Apache::lonstatistics::Gather_Full_Student_Data($r); |
Line 87 sub BuildProblemAnalysisPage {
|
Line 86 sub BuildProblemAnalysisPage {
|
# |
# |
my $resource = &get_resource_from_symb($symb); |
my $resource = &get_resource_from_symb($symb); |
if (defined($resource)) { |
if (defined($resource)) { |
|
$r->print('<h3>'.$resource->{'src'}.'</h3>'); |
my %Data = &get_problem_data($resource->{'src'}); |
my %Data = &get_problem_data($resource->{'src'}); |
my $ORdata = $Data{$part.'.'.$resid}; |
my $ORdata = $Data{$part.'.'.$resid}; |
## |
## |
Line 151 sub BuildProblemAnalysisPage {
|
Line 151 sub BuildProblemAnalysisPage {
|
######################################################### |
######################################################### |
sub build_foil_index { |
sub build_foil_index { |
my ($ORdata) = @_; |
my ($ORdata) = @_; |
|
return if (! exists($ORdata->{'Foils'})); |
my %Foildata = %{$ORdata->{'Foils'}}; |
my %Foildata = %{$ORdata->{'Foils'}}; |
my @Foils = sort(keys(%Foildata)); |
my @Foils = sort(keys(%Foildata)); |
my %Concepts; |
my %Concepts; |
Line 266 sub build_option_index {
|
Line 267 sub build_option_index {
|
my $table = "<table>\n"; |
my $table = "<table>\n"; |
my $optionindex = 0; |
my $optionindex = 0; |
my @Rows; |
my @Rows; |
foreach my $option ('correct',@{$ORdata->{'Options'}}) { |
foreach my $option (&mt('correct option chosen'),@{$ORdata->{'Options'}}) { |
push (@Rows, |
push (@Rows, |
'<tr>'. |
'<tr>'. |
'<td bgcolor="'.$plotcolors->[$optionindex++].'">'. |
'<td bgcolor="'.$plotcolors->[$optionindex++].'">'. |
Line 309 sub tries_analysis {
|
Line 310 sub tries_analysis {
|
if ($ENV{'form.AnalyzeAs'} eq 'Foils') { |
if ($ENV{'form.AnalyzeAs'} eq 'Foils') { |
$extrakey = &build_option_index($ORdata); |
$extrakey = &build_option_index($ORdata); |
$xlabel = 'Foil Number'; |
$xlabel = 'Foil Number'; |
$ylabel = 'Option Chosen'; |
$ylabel = 'Percent Choosing Option'; |
foreach my $foilid (@$Foils) { |
foreach my $foilid (@$Foils) { |
for (my $i=$mintries;$i<=$maxtries;$i++) { |
for (my $i=$mintries;$i<=$maxtries;$i++) { |
foreach my $option ('_correct',@{$ORdata->{'Options'}}) { |
foreach my $option ('_correct',@{$ORdata->{'Options'}}) { |
Line 417 sub analyze_option_data_by_tries {
|
Line 418 sub analyze_option_data_by_tries {
|
for (my $i=0;$i<=$#Foilgrades;$i++) { |
for (my $i=0;$i<=$#Foilgrades;$i++) { |
my ($foilid,$correct) = split('=',$Foilgrades[$i]); |
my ($foilid,$correct) = split('=',$Foilgrades[$i]); |
my (undef,$submission) = split('=',$Foilsubs[$i]); |
my (undef,$submission) = split('=',$Foilsubs[$i]); |
$submission = &HTML::Entities::decode($submission); |
$submission = &Apache::lonnet::unescape($submission); |
$submission =~ s/\%20/ /g; |
|
if ($correct) { |
if ($correct) { |
$Trydata{$foilid}->[$numtries]->{'_correct'}++; |
$Trydata{$foilid}->[$numtries]->{'_correct'}++; |
} else { |
} else { |
Line 767 sub get_problem_data {
|
Line 767 sub get_problem_data {
|
$key =~ s/^$part\.//; |
$key =~ s/^$part\.//; |
if (ref($value) eq 'ARRAY') { |
if (ref($value) eq 'ARRAY') { |
if ($key eq 'options') { |
if ($key eq 'options') { |
for(my $i=0;$i<scalar(@$value);$i++) { |
|
$value->[$i]=~ s/(\s*$|^\s*)//g; |
|
} |
|
$Partdata{$part}->{'Options'}=$value; |
$Partdata{$part}->{'Options'}=$value; |
} elsif ($key eq 'concepts') { |
} elsif ($key eq 'concepts') { |
$Partdata{$part}->{'Concepts'}=$value; |
$Partdata{$part}->{'Concepts'}=$value; |
} elsif ($key =~ /^concept\.(.*)$/) { |
} elsif ($key =~ /^concept\.(.*)$/) { |
my $concept = $1; |
my $concept = $1; |
foreach my $foil (@$value) { |
foreach my $foil (@$value) { |
$foil =~ s/(\s*$|^\s*)//g; |
|
$Partdata{$part}->{'Foils'}->{$foil}->{'Concept'}= |
$Partdata{$part}->{'Foils'}->{$foil}->{'Concept'}= |
$concept; |
$concept; |
} |
} |
} |
} |
} else { |
} else { |
$value =~ s/(\s*$|^\s*)//g; |
|
if ($key=~ /^foil\.text\.(.*)$/) { |
if ($key=~ /^foil\.text\.(.*)$/) { |
my $foil = $1; |
my $foil = $1; |
$foil =~ s/(\s*$|^\s*)//g; |
|
$Partdata{$part}->{'Foils'}->{$foil}->{'name'}=$foil; |
$Partdata{$part}->{'Foils'}->{$foil}->{'name'}=$foil; |
$Partdata{$part}->{'Foils'}->{$foil}->{'text'}=$value; |
$Partdata{$part}->{'Foils'}->{$foil}->{'text'}=$value; |
} elsif ($key =~ /^foil\.value\.(.*)$/) { |
} elsif ($key =~ /^foil\.value\.(.*)$/) { |
my $foil = $1; |
my $foil = $1; |
$foil =~ s/(\s*$|^\s*)//g; |
|
$Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; |
$Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; |
} |
} |
} |
} |