[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 28 Mar 2003 15:19:35 -0000


matthew		Fri Mar 28 10:19:35 2003 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  &get_problem_statistics
  Added POD.
  Implemented limiting of the stats to selected students.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.63 loncom/interface/loncoursedata.pm:1.64
--- loncom/interface/loncoursedata.pm:1.63	Thu Mar 27 14:29:36 2003
+++ loncom/interface/loncoursedata.pm	Fri Mar 28 10:19:35 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.63 2003/03/27 19:29:36 matthew Exp $
+# $Id: loncoursedata.pm,v 1.64 2003/03/28 15:19:35 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1150,6 +1150,43 @@
 
 Inputs: $students, $symb, $part, $courseid
 
+=over 4
+
+=item $students is an array of hash references.  
+Each hash must contain at least the 'username' and 'domain' of a student.
+
+=item $symb is the symb for the problem.
+
+=item $part is the part id you need statistics for
+
+=item $courseid is the course id, of course!
+
+=back
+
+Outputs: See the code for up to date information.
+
+=over 4
+
+=item $num The number of students attempting the problem
+
+=item $tries The total number of tries for the students
+
+=item $mod The maximum number of tries taken
+
+=item $mean The average number of tries
+
+=item $Solved The number of students able to solve the problem
+
+=item $solved The number of students whose answer is 'correct_by_override'
+
+=item $DegOfDiff The degree of difficulty of the problem
+
+=item $STD The standard deviation of the number of tries
+
+=item $SKEW The skew of the number of tries
+
+=back
+
 =cut
 
 ################################################
@@ -1182,6 +1219,14 @@
         'CREATE TEMPORARY TABLE '.$stats_table.
             ' SELECT student_id,solved,award,tries FROM '.$performance_table.
                 ' WHERE symb_id='.$symb_id.' AND part_id='.$part_id;
+    if (defined($students)) {
+        $request .= ' AND ('.
+            join(' OR ', map {'student_id='.
+                                  &get_student_id($_->{'username'},
+                                                  $_->{'domain'})
+                                  } @$students
+                 ).')';
+    }
 #    &Apache::lonnet::logthis($request);
     $dbh->do($request);
     my ($num,$tries,$mod,$mean,$STD) = &execute_SQL_request