--- loncom/interface/loncoursedata.pm 2004/03/07 20:53:40 1.121 +++ loncom/interface/loncoursedata.pm 2004/03/07 21:42:19 1.122 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.121 2004/03/07 20:53:40 matthew Exp $ +# $Id: loncoursedata.pm,v 1.122 2004/03/07 21:42:19 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1867,7 +1867,7 @@ populated and all local caching variable properly. This means you need to call &ensure_current_data for 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 @@ -1880,6 +1880,9 @@ Each hash must contain at least the 'use =item $courseid is the course id, of course! +=item $starttime and $endtime are unix times which to use to limit +the statistical data. + =back Outputs: See the code for up to date information. A hash reference is @@ -1915,7 +1918,7 @@ able to answer it correctly. ################################################ ################################################ sub get_problem_statistics { - my ($Sections,$status,$symb,$part,$courseid) = @_; + my ($Sections,$status,$symb,$part,$courseid,$starttime,$endtime) = @_; return if (! defined($symb) || ! defined($part)); $courseid = $ENV{'request.course.id'} if (! defined($courseid)); # @@ -1945,6 +1948,20 @@ sub get_problem_statistics { if (defined($status) && lc($status) ne 'any') { $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); # &Apache::lonnet::logthis('request = '.$/.$request); $request = 'SELECT COUNT(*),SUM(tries),MAX(tries),AVG(tries),STD(tries) '.