\n";
my $optionkey = &build_option_index($ORdata);
for (my $try=$mintries;$try<=$maxtries;$try++) {
my $count = $ResponseData{'_total'}->[$try];
- if ($count == 0) {
- $count = 'no submissions';
- } elsif ($count == 1) {
- $count = '1 submission';
- } else {
- $count = $count.' submissions';
- }
- my $title = 'Attempt '.$try.', '.$count;
+ my $title = 'Submission '.$try.' (N='.$count.')';
my @Datasets;
foreach my $option ('_correct',@{$ORdata->{'_Options'}}) {
next if (! exists($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
($title,'Foil Number','Percent Correct',
- 100,$plotcolors,undef,$Datasets[0]);
+ 100,$plotcolors,\@Labels,$Datasets[0]);
$analysis_html.= ''.$correctgraph.' | ';
#
@@ -630,17 +733,10 @@ sub OR_Tries_Foil_Analysis {
}
$count = $ResponseData{'_total'}->[$try] -
$ResponseData{'_correct'}->[$try];
- if ($count == 0) {
- $count = 'no submissions';
- } elsif ($count == 1) {
- $count = '1 submission';
- } else {
- $count = $count.' submissions';
- }
- $title = 'Attempt '.$try.', '.$count;
+ $title = 'Submission '.$try.' (N='.$count.')';
my $incorrectgraph = &Apache::loncommon::DrawBarGraph
($title,'Foil Number','% Option Chosen Incorrectly',
- 100,$plotcolors,undef,@Datasets);
+ 100,$plotcolors,\@Labels,@Datasets);
$analysis_html.= ''.$incorrectgraph.' | ';
$analysis_html.= ''.$optionkey." | |
\n";
}
@@ -1224,18 +1320,18 @@ sub build_foil_index {
if (@Concepts > 1) {
$table .= ''.
''.$conceptindex.' | '.
- ''.&HTML::Entities::encode($concept->{'name'}).' | '.
+ ''.&HTML::Entities::encode($concept->{'name'},'<>&"').' | '.
''.$foilindex++.' | '.
- ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'},'<>&"').' | '.
''.$Foildata{$firstfoil}->{'text'}.' | '.
- ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'},'<>&"').' | '.
"
\n";
} else {
$table .= ''.
''.$foilindex++.' | '.
- ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'name'},'<>&"').' | '.
''.$Foildata{$firstfoil}->{'text'}.' | '.
- ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$firstfoil}->{'value'},'<>&"').' | '.
"
\n";
}
foreach my $foilid (@FoilsInConcept) {
@@ -1244,16 +1340,16 @@ sub build_foil_index {
' | '.
' | '.
''.$foilindex.' | '.
- ''.&HTML::Entities::encode($Foildata{$foilid}->{'name'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$foilid}->{'name'},'<>&"').' | '.
''.$Foildata{$foilid}->{'text'}.' | '.
- ''.&HTML::Entities::encode($Foildata{$foilid}->{'value'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$foilid}->{'value'},'<>&"').' | '.
"\n";
} else {
$table .= ''.
''.$foilindex.' | '.
- ''.&HTML::Entities::encode($Foildata{$foilid}->{'name'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$foilid}->{'name'},'<>&"').' | '.
''.$Foildata{$foilid}->{'text'}.' | '.
- ''.&HTML::Entities::encode($Foildata{$foilid}->{'value'}).' | '.
+ ''.&HTML::Entities::encode($Foildata{$foilid}->{'value'},'<>&"').' | '.
"
\n";
}
} continue {
@@ -1278,7 +1374,7 @@ sub build_option_index {
''.
''.
(' 'x4).' | '.
- ''.&HTML::Entities::encode($option).' | '.
+ ''.&HTML::Entities::encode($option,'<>&"').' | '.
"
\n");
}
shift(@Rows); # Throw away 'correct option chosen' color