[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 26 Mar 2004 22:01:30 -0000
matthew Fri Mar 26 17:01:30 2004 EDT
Modified files:
/loncom/interface loncoursedata.pm
Log:
Modified &get_problem_statistics to return the number of students with the
problem wrong as well as the percent of students.
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.127 loncom/interface/loncoursedata.pm:1.128
--- loncom/interface/loncoursedata.pm:1.127 Tue Mar 23 11:35:15 2004
+++ loncom/interface/loncoursedata.pm Fri Mar 26 17:01:30 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.127 2004/03/23 16:35:15 matthew Exp $
+# $Id: loncoursedata.pm,v 1.128 2004/03/26 22:01:30 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2004,19 +2004,36 @@
$dbh->do($request);
#
# Collect the first suite of statistics
- $request = 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) '.
+ $request = 'SELECT COUNT(*),SUM(tries),'.
+ 'AVG(tries),STD(tries) '.
'FROM '.$stats_table;
- my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request
+ my ($num,$tries,$mean,$STD) = &execute_SQL_request
($dbh,$request);
+ #
+ $request = 'SELECT MAX(tries),MIN(tries) FROM '.$stats_table.
+ ' WHERE awarded>0';
+ if (defined($time_requirements)) {
+ $request .= ' AND '.$time_requirements;
+ }
+ my ($max,$min) = &execute_SQL_request($dbh,$request);
+ #
$request = 'SELECT SUM(awarded) FROM '.$stats_table;
+ if (defined($time_requirements)) {
+ $request .= ' AND '.$time_requirements;
+ }
my ($Solved) = &execute_SQL_request($dbh,$request);
+ #
$request = 'SELECT SUM(awarded) FROM '.$stats_table.
" WHERE solved='correct_by_override'";
+ if (defined($time_requirements)) {
+ $request .= ' AND '.$time_requirements;
+ }
my ($solved) = &execute_SQL_request($dbh,$request);
#
$num = 0 if (! defined($num));
$tries = 0 if (! defined($tries));
- $mod = 0 if (! defined($mod));
+ $max = 0 if (! defined($max));
+ $min = 0 if (! defined($min));
$STD = 0 if (! defined($STD));
$Solved = 0 if (! defined($Solved));
$solved = 0 if (! defined($solved));
@@ -2027,11 +2044,13 @@
#
my $SKEW = 'nan';
my $wrongpercent = 0;
+ my $numwrong = 'nan';
if ($num > 0) {
($SKEW) = &execute_SQL_request($dbh,'SELECT SQRT(SUM('.
'POWER(tries - '.$STD.',3)'.
'))/'.$num.' FROM '.$stats_table);
- $wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10;
+ $numwrong = $num-$Solved;
+ $wrongpercent=int(10*100*$numwrong/$num)/10;
}
#
# Drop the temporary table
@@ -2055,12 +2074,14 @@
# Return result
return { num_students => $num,
tries => $tries,
- max_tries => $mod,
+ max_tries => $max,
+ min_tries => $min,
mean_tries => $mean,
std_tries => $STD,
skew_tries => $SKEW,
num_solved => $Solved,
num_override => $solved,
+ num_wrong => $numwrong,
per_wrong => $wrongpercent,
deg_of_diff => $DegOfDiff };
}