Diff for /loncom/interface/loncoursedata.pm between versions 1.120 and 1.122

version 1.120, 2004/02/18 20:48:21 version 1.122, 2004/03/07 21:42:19
Line 182  sub get_sequence_assessment_data { Line 182  sub get_sequence_assessment_data {
             next;              next;
         }          }
         next if (! ref($curRes));          next if (! ref($curRes));
         next if (! $curRes->is_problem());# && !$curRes->randomout);          next if (! $curRes->is_problem() && $curRes->src() !~ /\.survey$/);
         # Okay, from here on out we only deal with assessments          # Okay, from here on out we only deal with assessments
         $title = $curRes->title();          $title = $curRes->title();
         $title =~ s/\:/\&\#058;/g;          $title =~ s/\:/\&\#058;/g;
Line 1867  populated and all local caching variable Line 1867  populated and all local caching variable
 properly.  This means you need to call &ensure_current_data for  properly.  This means you need to call &ensure_current_data for
 the students you are concerned with prior to calling this routine.  the students you are concerned with prior to calling this routine.
   
 Inputs: $students, $symb, $part, $courseid  Inputs: $students, $symb, $part, $courseid, $starttime, $endtime
   
 =over 4  =over 4
   
Line 1880  Each hash must contain at least the 'use Line 1880  Each hash must contain at least the 'use
   
 =item $courseid is the course id, of course!  =item $courseid is the course id, of course!
   
   =item $starttime and $endtime are unix times which to use to limit
   the statistical data.
   
 =back  =back
   
 Outputs: See the code for up to date information.  A hash reference is  Outputs: See the code for up to date information.  A hash reference is
Line 1915  able to answer it correctly. Line 1918  able to answer it correctly.
 ################################################  ################################################
 ################################################  ################################################
 sub get_problem_statistics {  sub get_problem_statistics {
     my ($Sections,$status,$symb,$part,$courseid) = @_;      my ($Sections,$status,$symb,$part,$courseid,$starttime,$endtime) = @_;
     return if (! defined($symb) || ! defined($part));      return if (! defined($symb) || ! defined($part));
     $courseid = $ENV{'request.course.id'} if (! defined($courseid));      $courseid = $ENV{'request.course.id'} if (! defined($courseid));
     #      #
Line 1945  sub get_problem_statistics { Line 1948  sub get_problem_statistics {
     if (defined($status) && lc($status) ne 'any') {      if (defined($status) && lc($status) ne 'any') {
         $request .= " AND b.status='".$status."'";          $request .= " AND b.status='".$status."'";
     }      }
       #
       &Apache::lonnet::logthis('starttime = '.$starttime);
       my $time_requirements = undef;
       if (defined($starttime)) {
           $time_requirements .= 'a.timestamp>='.$starttime;
           if (defined($endtime)) {
               $time_requirements .= ' AND a.timestamp<='.$endtime;
           }
       } elsif (defined($endtime)) {
           $time_requirements .= 'a.timestamp<='.$endtime;
       }
       if (defined($time_requirements)) {
           $request .= ' AND '.$time_requirements;
       }
     $dbh->do($request);      $dbh->do($request);
 #    &Apache::lonnet::logthis('request = '.$/.$request);  #    &Apache::lonnet::logthis('request = '.$/.$request);
     $request = 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) '.      $request = 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) '.
Line 2232  sub get_response_time_data { Line 2249  sub get_response_time_data {
 ################################################  ################################################
 ################################################  ################################################
 sub get_student_scores {  sub get_student_scores {
     my ($Sections,$Symbs,$enrollment,$courseid) = @_;      my ($Sections,$Symbs,$enrollment,$courseid,$starttime,$endtime) = @_;
     $courseid = $ENV{'request.course.id'} if (! defined($courseid));      $courseid = $ENV{'request.course.id'} if (! defined($courseid));
     &setup_table_names($courseid);      &setup_table_names($courseid);
     my $dbh = &Apache::lonmysql::get_dbh();      my $dbh = &Apache::lonmysql::get_dbh();
Line 2243  sub get_student_scores { Line 2260  sub get_student_scores {
     if (defined($Symbs)  && @$Symbs) {      if (defined($Symbs)  && @$Symbs) {
         $symb_requirements = '('.          $symb_requirements = '('.
             join(' OR ', map{ "(a.symb_id='".&get_symb_id($_->{'symb'}).              join(' OR ', map{ "(a.symb_id='".&get_symb_id($_->{'symb'}).
                                   "' AND a.part_id='".&get_part_id($_->{'part'}).                                "' AND a.part_id='".&get_part_id($_->{'part'}).
                                   "')"                                "')"
                               } @$Symbs).')';                                } @$Symbs).')';
     }      }
     #      #
Line 2259  sub get_student_scores { Line 2276  sub get_student_scores {
     if (defined($enrollment) && $enrollment ne 'Any') {      if (defined($enrollment) && $enrollment ne 'Any') {
         $enrollment_requirements = "b.status='".$enrollment."'";          $enrollment_requirements = "b.status='".$enrollment."'";
     }      }
       #
       my $time_requirements = undef;
       if (defined($starttime)) {
           $time_requirements .= "a.timestamp>='".$starttime."'";
           if (defined($endtime)) {
               $time_requirements .= " AND a.timestamp<='".$endtime."'";
           }
       } elsif (defined($endtime)) {
           $time_requirements .= "a.timestamp<='".$endtime."'";
       }
     ##      ##
     ##      ##
     my $request = 'CREATE TEMPORARY TABLE IF NOT EXISTS '.$tmptable.      my $request = 'CREATE TEMPORARY TABLE IF NOT EXISTS '.$tmptable.
Line 2281  sub get_student_scores { Line 2308  sub get_student_scores {
     if (defined($enrollment_requirements)) {      if (defined($enrollment_requirements)) {
         $request .= $enrollment_requirements.' AND ';          $request .= $enrollment_requirements.' AND ';
     }      }
     $request =~ s/ AND $//;      if (defined($time_requirements)) {
           $request .= $time_requirements.' AND ';
       }
       $request =~ s/ AND $//; # Strip of the trailing ' AND '.
     $request .= ' GROUP BY a.student_id';      $request .= ' GROUP BY a.student_id';
 #    &Apache::lonnet::logthis("request = \n".$request);  #    &Apache::lonnet::logthis("request = \n".$request);
     my $sth = $dbh->prepare($request);      my $sth = $dbh->prepare($request);

Removed from v.1.120  
changed lines
  Added in v.1.122


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>