[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemanalysis.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Tue, 15 Mar 2005 00:51:44 -0000
matthew Mon Mar 14 19:51:44 2005 EDT
Modified files:
/loncom/interface/statistics lonproblemanalysis.pm
Log:
Make sure we ahve a value (not undef) for the number of correct answers.
Fixed unfinished code in numerical response analysis.
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.118 loncom/interface/statistics/lonproblemanalysis.pm:1.119
--- loncom/interface/statistics/lonproblemanalysis.pm:1.118 Mon Mar 14 15:28:22 2005
+++ loncom/interface/statistics/lonproblemanalysis.pm Mon Mar 14 19:51:43 2005
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemanalysis.pm,v 1.118 2005/03/14 20:28:22 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.119 2005/03/15 00:51:43 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -482,8 +482,12 @@
if ($stats{'max_abs'} < $abs_high) {
$stats{'max_abs'} = $abs_high;
}
- my $low_percent = 100 * abs($abs_low / $subm{'correct'});
- my $high_percent = 100 * abs($abs_high / $subm{'correct'});
+ my $low_percent;
+ my $high_percent;
+ if (defined($subm{'correct'}) && $subm{'correct'} != 0) {
+ $low_percent = 100 * abs($abs_low / $subm{'correct'});
+ $high_percent = 100 * abs($abs_high / $subm{'correct'});
+ }
if (! defined($stats{'min_percent'}) ||
$stats{'min_percent'} > $low_percent) {
$stats{'min_percent'} = $low_percent;
@@ -531,6 +535,8 @@
}
}
}
+ $stats{'correct_count'} |= 0;
+ $stats{'incorrect_count'} |= 0;
$stats{'students'}=scalar(keys(%students));
return (\%submission_data,\%stats);
}
@@ -882,16 +888,14 @@
$choice_plot ne '' ||
$stacked_plot ne '') {
my $correct = $foil_choice_data->{'_correct'};
- if (! defined($correct) || $correct eq '') {
- $correct = 0;
- }
- my $incorrect =
+ $correct |= 0;
+ my $incorrect = $foil_choice_data->{'_count'}-$correct;
$analysis_html.= '<tr><td colspan="4" align="center">'.
'<font size="+1">'.
&mt($pre_graph_text,
$plot_num,$foil_choice_data->{'_count'},
$correct,
- $foil_choice_data->{'_count'}-$correct,
+ $incorrect,
$foil_choice_data->{'_students'},
@extra_data).
'</td></tr>'.$/;
@@ -1309,7 +1313,7 @@
# Create Foil Plots
my $data_count = $response_data{'_total'}->[$try];
my $correct = $response_data{'_correct'}->[$try];
- if (! defined($correct)) { $correct = 0; }
+ $correct |= 0;
my @Datasets;
foreach my $option ('_correct',@{$ORdata->{'_Options'}}) {
next if (! exists($foil_plot[$try]->{$option}));
@@ -1472,6 +1476,7 @@
##
my ($processed_time_data,$correct,$data_count,$student_count) =
&OR_time_process_data($performance_data,$begin_index,$end_index);
+ $correct |= 0;
##
$table .= '<tr><td colspan="4" align="center"><font size="+1">'.
&mt('[_1] submissions from [_2] students, [_3] correct, [_4] incorrect',