version 1.129, 2004/04/01 20:02:55
|
version 1.130, 2004/04/06 15:45:13
|
Line 2056 sub get_problem_statistics {
|
Line 2056 sub get_problem_statistics {
|
# Drop the temporary table |
# Drop the temporary table |
$dbh->do('DROP TABLE '.$stats_table); # May return an error |
$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 result |
return { num_students => $num, |
return { num_students => $num, |
tries => $tries, |
tries => $tries, |
Line 2247 sub RNK_student { return 0; };
|
Line 2232 sub RNK_student { return 0; };
|
sub RNK_score { return 1; }; |
sub RNK_score { return 1; }; |
|
|
sub rank_students_by_scores_on_resources { |
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'); |
return if (! defined($resources) || ! ref($resources) eq 'ARRAY'); |
if (! defined($courseid)) { |
if (! defined($courseid)) { |
$courseid = $ENV{'request.course.id'}; |
$courseid = $ENV{'request.course.id'}; |
Line 2260 sub rank_students_by_scores_on_resources
|
Line 2245 sub rank_students_by_scores_on_resources
|
my $symb_limits = '('.join(' OR ',map {'a.symb_id='.&get_symb_id($_); |
my $symb_limits = '('.join(' OR ',map {'a.symb_id='.&get_symb_id($_); |
} @$resources |
} @$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 '. |
my $request = 'SELECT b.student,SUM(a.awarded*w.weight) AS score FROM '. |
$performance_table.' AS a '. |
$performance_table.' AS a '. |
'NATURAL LEFT JOIN '.$weight_table.' AS w '. |
'NATURAL LEFT JOIN '.$weight_table.' AS w '. |
Line 2271 sub rank_students_by_scores_on_resources
|
Line 2257 sub rank_students_by_scores_on_resources
|
if (defined($enrollment_limits)) { |
if (defined($enrollment_limits)) { |
$request .= $enrollment_limits.' AND '; |
$request .= $enrollment_limits.' AND '; |
} |
} |
|
if (defined($time_limits)) { |
|
$request .= $time_limits.' AND '; |
|
} |
if ($symb_limits ne '()') { |
if ($symb_limits ne '()') { |
$request .= $symb_limits.' AND '; |
$request .= $symb_limits.' AND '; |
} |
} |
Line 2304 Returns: the sum of the score on the pro
|
Line 2293 Returns: the sum of the score on the pro
|
######################################################## |
######################################################## |
######################################################## |
######################################################## |
sub get_sum_of_scores { |
sub get_sum_of_scores { |
my ($resource,$part,$students,$courseid) = @_; |
my ($resource,$part,$students,$courseid,$starttime,$endtime) = @_; |
if (! defined($courseid)) { |
if (! defined($courseid)) { |
$courseid = $ENV{'request.course.id'}; |
$courseid = $ENV{'request.course.id'}; |
} |
} |
# |
# |
&setup_table_names($courseid); |
&setup_table_names($courseid); |
my $dbh = &Apache::lonmysql::get_dbh(); |
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 '. |
my $request = 'SELECT SUM(a.awarded*w.weight),SUM(w.weight) FROM '. |
$performance_table.' AS a '. |
$performance_table.' AS a '. |
'NATURAL LEFT JOIN '.$weight_table.' AS w '; |
'NATURAL LEFT JOIN '.$weight_table.' AS w '; |
$request .= 'WHERE a.symb_id='.&get_symb_id($resource->{'symb'}). |
$request .= 'WHERE a.symb_id='.&get_symb_id($resource->{'symb'}). |
' AND a.part_id='.&get_part_id($part); |
' AND a.part_id='.&get_part_id($part); |
|
if (defined($time_limits)) { |
|
$request .= ' AND '.$time_limits; |
|
} |
if (defined($students)) { |
if (defined($students)) { |
$request .= ' AND ('. |
$request .= ' AND ('. |
join(' OR ',map {'a.student_id='.&get_student_id(split(':',$_)); |
join(' OR ',map {'a.student_id='.&get_student_id(split(':',$_)); |