version 1.75, 2004/03/11 19:34:10
|
version 1.77, 2004/03/11 20:11:18
|
Line 570 sub OR_Tries_Foil_Analysis {
|
Line 570 sub OR_Tries_Foil_Analysis {
|
my @PlotData; |
my @PlotData; |
foreach my $concept (@$Concepts) { |
foreach my $concept (@$Concepts) { |
foreach my $foilid (@{$concept->{'foils'}}) { |
foreach my $foilid (@{$concept->{'foils'}}) { |
for (my $i=$mintries;$i<=$maxtries;$i++) { |
for (my $try=$mintries;$try<=$maxtries;$try++) { |
if ($ResponseData{$foilid}->[$i]->{'_total'} == 0) { |
if ($ResponseData{$foilid}->[$try]->{'_total'} == 0) { |
push(@{$PlotData[$i]->{'_correct'}},0); |
push(@{$PlotData[$try]->{'_correct'}},0); |
} else { |
} else { |
push(@{$PlotData[$i]->{'_correct'}}, |
push(@{$PlotData[$try]->{'_correct'}}, |
100*$ResponseData{$foilid}->[$i]->{'_correct'}/ |
100*$ResponseData{$foilid}->[$try]->{'_correct'}/ |
$ResponseData{$foilid}->[$i]->{'_total'}); |
$ResponseData{$foilid}->[$try]->{'_total'}); |
} |
} |
foreach my $option (@{$ORdata->{'_Options'}}) { |
foreach my $option (@{$ORdata->{'_Options'}}) { |
push(@{$PlotData[$i]->{'_total'}}, |
push(@{$PlotData[$try]->{'_total'}}, |
$ResponseData{$foilid}->[$i]->{'_total'}); |
$ResponseData{$foilid}->[$try]->{'_total'}); |
if ($ResponseData{$foilid}->[$i]->{'_total'} == 0) { |
if ($ResponseData{$foilid}->[$try]->{'_total'} == 0) { |
push (@{$PlotData[$i]->{$option}},0); |
push (@{$PlotData[$try]->{$option}},0); |
} else { |
} else { |
if ($ResponseData{$foilid}->[$i]->{'_total'} == |
if ($ResponseData{$foilid}->[$try]->{'_total'} == |
$ResponseData{$foilid}->[$i]->{'_correct'}) { |
$ResponseData{$foilid}->[$try]->{'_correct'}) { |
push(@{$PlotData[$i]->{$option}},0); |
push(@{$PlotData[$try]->{$option}},0); |
} else { |
} else { |
push (@{$PlotData[$i]->{$option}}, |
push (@{$PlotData[$try]->{$option}}, |
100 * $ResponseData{$foilid}->[$i]->{$option} / |
100 * |
($ResponseData{$foilid}->[$i]->{'_total'} - |
$ResponseData{$foilid}->[$try]->{$option} / |
$ResponseData{$foilid}->[$i]->{'_correct'})); |
($ResponseData{$foilid}->[$try]->{'_total'} |
|
- |
|
$ResponseData{$foilid}->[$try]->{'_correct'} |
|
)); |
} |
} |
} |
} |
} |
} # End of foreach my $option |
} |
} |
} |
} # End of foreach my $foilid |
} |
} # End of foreach my $concept |
# |
# |
# Build a table for the plots |
# Build a table for the plots |
my $analysis_html = "<table>\n"; |
my $analysis_html = "<table>\n"; |
my $optionkey = &build_option_index($ORdata); |
my $optionkey = &build_option_index($ORdata); |
for (my $try=$mintries;$try<=$maxtries;$try++) { |
for (my $try=$mintries;$try<=$maxtries;$try++) { |
my $count = $ResponseData{'_total'}->[$try]; |
my $count = $ResponseData{'_total'}->[$try]; |
if ($count == 0) { |
my $title = 'Submission '.$try.' (N='.$count.')'; |
$count = 'no submissions'; |
|
} elsif ($count == 1) { |
|
$count = '1 submission'; |
|
} else { |
|
$count = $count.' submissions'; |
|
} |
|
my $title = 'Attempt '.$try.', '.$count; |
|
my @Datasets; |
my @Datasets; |
foreach my $option ('_correct',@{$ORdata->{'_Options'}}) { |
foreach my $option ('_correct',@{$ORdata->{'_Options'}}) { |
next if (! exists($PlotData[$try]->{$option})); |
next if (! exists($PlotData[$try]->{$option})); |
push(@Datasets,$PlotData[$try]->{$option}); |
push(@Datasets,$PlotData[$try]->{$option}); |
} |
} |
|
# |
|
# Put a blank in the data set between concepts |
|
for (my $set =0;$set<=$#Datasets;$set++) { |
|
my @Data = @{$Datasets[$set]}; |
|
my $idx = 0; |
|
foreach my $concept (@{$Concepts}) { |
|
foreach my $foilid (@{$concept->{'foils'}}) { |
|
$Datasets[$set]->[$idx++]=shift(@Data); |
|
} |
|
if ($concept->{'name'} ne $Concepts->[-1]->{'name'}) { |
|
$Datasets[$set]->[$idx++] = 0; |
|
} |
|
} |
|
} |
|
# |
|
# Set up the labels needed for the bar graph |
|
my @Labels; |
|
my $idx = 1; |
|
foreach my $concept (@{$Concepts}) { |
|
foreach my $foilid (@{$concept->{'foils'}}) { |
|
push(@Labels,$idx++); |
|
} |
|
push(@Labels,''); |
|
} |
|
# |
my $correctgraph = &Apache::loncommon::DrawBarGraph |
my $correctgraph = &Apache::loncommon::DrawBarGraph |
($title,'Foil Number','Percent Correct', |
($title,'Foil Number','Percent Correct', |
100,$plotcolors,undef,$Datasets[0]); |
100,$plotcolors,\@Labels,$Datasets[0]); |
$analysis_html.= '<tr><td>'.$correctgraph.'</td>'; |
$analysis_html.= '<tr><td>'.$correctgraph.'</td>'; |
|
|
# |
# |
Line 630 sub OR_Tries_Foil_Analysis {
|
Line 651 sub OR_Tries_Foil_Analysis {
|
} |
} |
$count = $ResponseData{'_total'}->[$try] - |
$count = $ResponseData{'_total'}->[$try] - |
$ResponseData{'_correct'}->[$try]; |
$ResponseData{'_correct'}->[$try]; |
if ($count == 0) { |
$title = 'Submission '.$try.' (N='.$count.')'; |
$count = 'no submissions'; |
|
} elsif ($count == 1) { |
|
$count = '1 submission'; |
|
} else { |
|
$count = $count.' submissions'; |
|
} |
|
$title = 'Attempt '.$try.', '.$count; |
|
my $incorrectgraph = &Apache::loncommon::DrawBarGraph |
my $incorrectgraph = &Apache::loncommon::DrawBarGraph |
($title,'Foil Number','% Option Chosen Incorrectly', |
($title,'Foil Number','% Option Chosen Incorrectly', |
100,$plotcolors,undef,@Datasets); |
100,$plotcolors,\@Labels,@Datasets); |
$analysis_html.= '<td>'.$incorrectgraph.'</td>'; |
$analysis_html.= '<td>'.$incorrectgraph.'</td>'; |
$analysis_html.= '<td>'.$optionkey."<td></tr>\n"; |
$analysis_html.= '<td>'.$optionkey."<td></tr>\n"; |
} |
} |