--- loncom/interface/loncoursedata.pm 2004/04/01 20:02:55 1.129 +++ loncom/interface/loncoursedata.pm 2004/04/06 15:45:13 1.130 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.129 2004/04/01 20:02:55 matthew Exp $ +# $Id: loncoursedata.pm,v 1.130 2004/04/06 15:45:13 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2056,21 +2056,6 @@ sub get_problem_statistics { # Drop the temporary table $dbh->do('DROP TABLE '.$stats_table); # May return an error # - # Store in metadata - if ($num) { - my %storestats=(); - # - my $urlres=(&Apache::lonnet::decode_symb($symb))[2]; - # - $storestats{$courseid.'___'.$urlres.'___timestamp'}=time; - $storestats{$courseid.'___'.$urlres.'___stdno'}=$num; - $storestats{$courseid.'___'.$urlres.'___avetries'}=$mean; - $storestats{$courseid.'___'.$urlres.'___difficulty'}=$DegOfDiff; - # - $urlres=~/^(\w+)\/(\w+)/; - &Apache::lonnet::put('nohist_resevaldata',\%storestats,$1,$2); - } - # # Return result return { num_students => $num, tries => $tries, @@ -2247,7 +2232,7 @@ sub RNK_student { return 0; }; sub RNK_score { return 1; }; sub rank_students_by_scores_on_resources { - my ($resources,$Sections,$enrollment,$courseid) = @_; + my ($resources,$Sections,$enrollment,$courseid,$starttime,$endtime) = @_; return if (! defined($resources) || ! ref($resources) eq 'ARRAY'); if (! defined($courseid)) { $courseid = $ENV{'request.course.id'}; @@ -2260,6 +2245,7 @@ sub rank_students_by_scores_on_resources my $symb_limits = '('.join(' OR ',map {'a.symb_id='.&get_symb_id($_); } @$resources ).')'; + my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a'); my $request = 'SELECT b.student,SUM(a.awarded*w.weight) AS score FROM '. $performance_table.' AS a '. 'NATURAL LEFT JOIN '.$weight_table.' AS w '. @@ -2271,6 +2257,9 @@ sub rank_students_by_scores_on_resources if (defined($enrollment_limits)) { $request .= $enrollment_limits.' AND '; } + if (defined($time_limits)) { + $request .= $time_limits.' AND '; + } if ($symb_limits ne '()') { $request .= $symb_limits.' AND '; } @@ -2304,18 +2293,22 @@ Returns: the sum of the score on the pro ######################################################## ######################################################## sub get_sum_of_scores { - my ($resource,$part,$students,$courseid) = @_; + my ($resource,$part,$students,$courseid,$starttime,$endtime) = @_; if (! defined($courseid)) { $courseid = $ENV{'request.course.id'}; } # &setup_table_names($courseid); my $dbh = &Apache::lonmysql::get_dbh(); + my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a'); my $request = 'SELECT SUM(a.awarded*w.weight),SUM(w.weight) FROM '. $performance_table.' AS a '. 'NATURAL LEFT JOIN '.$weight_table.' AS w '; $request .= 'WHERE a.symb_id='.&get_symb_id($resource->{'symb'}). ' AND a.part_id='.&get_part_id($part); + if (defined($time_limits)) { + $request .= ' AND '.$time_limits; + } if (defined($students)) { $request .= ' AND ('. join(' OR ',map {'a.student_id='.&get_student_id(split(':',$_));