--- loncom/homework/grades.pm 2007/08/24 07:15:27 1.428.2.1
+++ loncom/homework/grades.pm 2007/08/21 18:48:18 1.431
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.428.2.1 2007/08/24 07:15:27 albertel Exp $
+# $Id: grades.pm,v 1.431 2007/08/21 18:48:18 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,7 +45,7 @@ use LONCAPA;
use POSIX qw(floor);
-my %perm;
+my %perm=();
# ----- These first few routines are general use routines.----
#
@@ -194,54 +194,22 @@ sub showResourceInfo {
return $result,$responseType,$hdgrade,$partlist,$handgrade;
}
-sub reset_caches {
- &reset_analyze_cache();
- &reset_perm();
-}
-
-{
- my %analyze_cache;
- sub reset_analyze_cache {
- undef(%analyze_cache);
- }
-
- sub get_analyze {
- my ($symb,$uname,$udom)=@_;
- my $key = "$symb\0$uname\0$udom";
- return $analyze_cache{$key} if (exists($analyze_cache{$key}));
-
- my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
- $url=&Apache::lonnet::clutter($url);
- my $subresult=&Apache::lonnet::ssi($url,
- ('grade_target' => 'analyze'),
- ('grade_domain' => $udom),
- ('grade_symb' => $symb),
- ('grade_courseid' =>
- $env{'request.course.id'}),
- ('grade_username' => $uname));
- (undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
- my %analyze=&Apache::lonnet::str2hash($subresult);
- return $analyze_cache{$key} = \%analyze;
- }
-
- sub get_order {
- my ($partid,$respid,$symb,$uname,$udom)=@_;
- my $analyze = &get_analyze($symb,$uname,$udom);
- return $analyze->{"$partid.$respid.shown"};
- }
-
- sub get_radiobutton_correct_foil {
- my ($partid,$respid,$symb,$uname,$udom)=@_;
- my $analyze = &get_analyze($symb,$uname,$udom);
- foreach my $foil (@{&get_order($partid,$respid,$symb,$uname,$udom)}) {
- if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') {
- return $foil;
- }
- }
- }
+sub get_order {
+ my ($partid,$respid,$symb,$uname,$udom)=@_;
+ my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
+ $url=&Apache::lonnet::clutter($url);
+ my $subresult=&Apache::lonnet::ssi($url,
+ ('grade_target' => 'analyze'),
+ ('grade_domain' => $udom),
+ ('grade_symb' => $symb),
+ ('grade_courseid' =>
+ $env{'request.course.id'}),
+ ('grade_username' => $uname));
+ (undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
+ my %analyze=&Apache::lonnet::str2hash($subresult);
+ return ($analyze{"$partid.$respid.shown"});
}
-
#--- Clean response type for display
#--- Currently filters option/rank/radiobutton/match/essay/Task
# response types only.
@@ -290,11 +258,11 @@ sub cleanRecord {
} elsif ($response eq 'radiobutton') {
my %answer=&Apache::lonnet::str2hash($answer);
my ($toprow,$bottomrow);
- my $correct =
- &get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom);
- foreach my $foil (@$order) {
+ my $correct=($order->[0])+1;
+ for (my $i=1;$i<=$#$order;$i++) {
+ my $foil=$order->[$i];
if (exists($answer{$foil})) {
- if ($foil eq $correct) {
+ if ($i == $correct) {
$toprow.='
true | ';
} else {
$toprow.='true | ';
@@ -3003,14 +2971,15 @@ sub viewgrades {
''."\n";
my $sectionClass;
+ my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
if ($env{'form.section'} eq 'all') {
$sectionClass='Class ';
} elsif ($env{'form.section'} eq 'none') {
- $sectionClass='Students in no Section ';
+ $sectionClass=&mt('Students in no Section').'';
} else {
- $sectionClass='Students in Section '.$env{'form.section'}.'';
+ $sectionClass=&mt('Students in Section(s) [_1]',$section_display).'';
}
- $result.='Assign Common Grade To '.$sectionClass;
+ $result.=''.&mt('Assign Common Grade To [_1]',$sectionClass);
$result.= '
'."\n".
'';
#radio buttons/text box for assigning points for a section or class.
@@ -6964,7 +6933,7 @@ GRADINGMENUJS
$result.='';
$result.=''."\n".
- ' '.&mt('Select Section').': | |
|