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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 30 Oct 2003 16:20:18 -0000


matthew		Thu Oct 30 11:20:18 2003 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
    /loncom/interface/statistics	lonsubmissiontimeanalysis.pm 
  Log:
  Taking a que from Jeremy, using subroutines to indicate the array entries 
  in which data resides.  Also renamed get_optionresponse_data to 
  get_response_data and added the students name:domain as a return value.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.107 loncom/interface/loncoursedata.pm:1.108
--- loncom/interface/loncoursedata.pm:1.107	Mon Oct 27 16:07:22 2003
+++ loncom/interface/loncoursedata.pm	Thu Oct 30 11:20:18 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.107 2003/10/27 21:07:22 matthew Exp $
+# $Id: loncoursedata.pm,v 1.108 2003/10/30 16:20:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2018,7 +2018,15 @@
     }
 }
 
-sub get_optionresponse_data {
+sub RD_student_id    { return 0; }
+sub RD_awarddetail   { return 1; }
+sub RD_response_eval { return 2; }
+sub RD_submission    { return 3; }
+sub RD_timestamp     { return 4; }
+sub RD_tries         { return 5; }
+sub RD_sname         { return 6; }
+
+sub get_response_data {
     my ($students,$symb,$response,$courseid) = @_;
     return undef if (! defined($symb) || 
                ! defined($response));
@@ -2032,7 +2040,7 @@
     return undef if (! defined($dbh));
     my $request = 'SELECT '.
         'a.student_id, a.awarddetail, a.response_specific_value, '.
-        'a.submission, b.timestamp, c.tries '.
+        'a.submission, b.timestamp, c.tries, d.student '.
         'FROM '.$fulldump_response_table.' AS a '.
         'LEFT JOIN '.$fulldump_timestamp_table.' AS b '.
         'ON a.symb_id=b.symb_id AND a.student_id=b.student_id AND '.
@@ -2040,6 +2048,8 @@
         'LEFT JOIN '.$fulldump_part_table.' AS c '.
         'ON a.symb_id=c.symb_id AND a.student_id=c.student_id AND '.        
         'a.part_id=c.part_id AND a.transaction = c.transaction '.
+        'LEFT JOIN '.$student_table.' AS d '.
+        'ON a.student_id=d.student_id '.
         'WHERE '.
         'a.symb_id='.$symb_id.' AND a.response_id='.$response_id;
     if (defined($students)) {
@@ -2063,6 +2073,11 @@
         return $dataset;
     }
 }
+
+sub RT_student_id { return 0; }
+sub RT_awarded    { return 1; }
+sub RT_tries      { return 2; }
+sub RT_timestamp  { return 3; }
 
 sub get_response_time_data {
     my ($students,$symb,$part,$courseid) = @_;
Index: loncom/interface/statistics/lonsubmissiontimeanalysis.pm
diff -u loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.2 loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.3
--- loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.2	Wed Oct 29 13:59:46 2003
+++ loncom/interface/statistics/lonsubmissiontimeanalysis.pm	Thu Oct 30 11:20:18 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsubmissiontimeanalysis.pm,v 1.2 2003/10/29 18:59:46 matthew Exp $
+# $Id: lonsubmissiontimeanalysis.pm,v 1.3 2003/10/30 16:20:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -261,7 +261,7 @@
 sub successful_submission {
     my ($row) = @_;
     if (ref($row) eq 'ARRAY') {
-        return $row->[1];
+        return $row->[&Apache::loncoursedata::RT_awarded()];
     }
     return undef;
     return 0;
@@ -270,7 +270,7 @@
 sub get_time_from_row {
     my ($row) = @_;
     if (ref($row) eq 'ARRAY') {
-        return $row->[3];
+        return $row->[&Apache::loncoursedata::RT_timestamp()];
     } 
     return undef;
 }
@@ -278,7 +278,7 @@
 sub get_tries_from_row {
     my ($row) = @_;
     if (ref($row) eq 'ARRAY') {
-        return $row->[2];
+        return $row->[&Apache::loncoursedata::RT_tries()];
     }
     return undef;
 }