--- loncom/homework/grades.pm 2008/06/24 17:42:01 1.523 +++ loncom/homework/grades.pm 2008/06/24 18:54:36 1.524 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.523 2008/06/24 17:42:01 raeburn Exp $ +# $Id: grades.pm,v 1.524 2008/06/24 18:54:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -240,8 +240,8 @@ sub showResourceInfo { my %resptype = (); my $hdgrade='no'; my %partsseen; - foreach my $partID (sort keys(%$responseType)) { - foreach my $resID (sort keys(%{ $responseType->{$partID} })) { + foreach my $partID (sort(keys(%$responseType))) { + foreach my $resID (sort(keys(%{ $responseType->{$partID} }))) { my $handgrade=$$handgrade{$partID.'_'.$resID}; my $responsetype = $responseType->{$partID}->{$resID}; $hdgrade = $handgrade if ($handgrade eq 'yes'); @@ -1030,7 +1030,7 @@ LISTJAVASCRIPT ' '.$section.($group ne '' ?'/'.$group:'').''."\n"; if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') { - foreach (sort keys(%status)) { + foreach (sort(keys(%status))) { next if ($_ =~ /^resource.*?submitted_by$/); $gradeTable.=' '.&mt($status{$_}).' '."\n"; } @@ -2225,8 +2225,8 @@ KEYWORDS $seen{$partid}++; next if ($$handgrade{$part_resp} ne 'yes' && $env{'form.lastSub'} eq 'hdgrade'); - push @partlist,$partid; - push @gradePartRespid,$partid.'.'.$respid; + push(@partlist,$partid); + push(@gradePartRespid,$partid.'.'.$respid); $request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record)); } $request->print(''); @@ -2553,7 +2553,7 @@ sub processHandGrade { my (@parsedlist,@nextlist); my ($nextflg) = 0; - foreach (sort + foreach my $item (sort { if (lc($$fullname{$a}) ne lc($$fullname{$b})) { return (lc($$fullname{$a}) cmp lc($$fullname{$b})); @@ -2561,12 +2561,12 @@ sub processHandGrade { return $a cmp $b; } (keys(%$fullname))) { if ($nextflg == 1 && $button =~ /Next$/) { - push @parsedlist,$_; + push(@parsedlist,$item); } - $nextflg = 1 if ($_ eq $laststu); + $nextflg = 1 if ($item eq $laststu); if ($button eq 'Previous') { - last if ($_ eq $firststu); - push @parsedlist,$_; + last if ($item eq $firststu); + push(@parsedlist,$item); } } $ctr = 0; @@ -2589,11 +2589,11 @@ sub processHandGrade { my $submitted = 0; my $ungraded = 0; my $incorrect = 0; - foreach (keys(%status)) { - $submitted = 1 if ($status{$_} ne 'nothing'); - $ungraded = 1 if ($status{$_} =~ /^ungraded/); - $incorrect = 1 if ($status{$_} =~ /^incorrect/); - my ($foo,$partid,$foo1) = split(/\./,$_); + foreach my $item (keys(%status)) { + $submitted = 1 if ($status{$item} ne 'nothing'); + $ungraded = 1 if ($status{$item} =~ /^ungraded/); + $incorrect = 1 if ($status{$item} =~ /^incorrect/); + my ($foo,$partid,$foo1) = split(/\./,$item); if ($status{'resource.'.$partid.'.submitted_by'} ne '') { $submitted = 0; } @@ -2604,7 +2604,7 @@ sub processHandGrade { next if (!$ungraded && ($submitonly eq 'graded')); next if (!$incorrect && $submitonly eq 'incorrect'); } - push @nextlist,$student if ($ctr < $ntstu); + push(@nextlist,$student) if ($ctr < $ntstu); last if ($ctr == $ntstu); $ctr++; } @@ -2612,7 +2612,7 @@ sub processHandGrade { $ctr = 0; my $total = scalar(@nextlist)-1; - foreach (sort @nextlist) { + foreach (sort(@nextlist)) { my ($uname,$udom,$submitter) = split(/:/); $env{'form.student'} = $uname; $env{'form.userdom'} = $udom; @@ -2658,7 +2658,7 @@ sub saveHandGrade { } } elsif ($dropMenu eq 'reset status' && exists($record{'resource.'.$new_part.'.solved'})) { #don't bother if no old records -> no attempts - foreach my $key (keys (%record)) { + foreach my $key (keys(%record)) { if ($key=~/^resource\.\Q$new_part\E\./) { $newrecord{$key} = ''; } } $newrecord{'resource.'.$new_part.'.regrader'}= @@ -2693,7 +2693,7 @@ sub saveHandGrade { &handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord); next; } else { - push @parts_graded, $new_part; + push(@parts_graded,$new_part); } if ($record{'resource.'.$new_part.'.awarded'} ne $partial) { $newrecord{'resource.'.$new_part.'.awarded'} = $partial; @@ -2720,7 +2720,7 @@ sub saveHandGrade { $record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || $dropMenu eq 'reset status') { - push (@version_parts,$new_part); + push(@version_parts,$new_part); } } my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -2893,7 +2893,7 @@ sub decrement_aggs { if ($aggtries == $totaltries) { $decrement{'users'} = 1; } - foreach my $type (keys (%decrement)) { + foreach my $type (keys(%decrement)) { $$aggregate{$symb."\0".$part."\0".$type} = -$decrement{$type}; } return; @@ -3294,7 +3294,7 @@ sub viewgrades { $display =~ s|^Number of Attempts|Tries
|; # makes the column narrower if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } my ($partid) = &split_part_type($part); - push(@partids, $partid); + push(@partids,$partid); my $display_part=&get_display_part($partid,$symb); if ($display =~ /^Partial Credit Factor/) { $result.=''. @@ -3448,7 +3448,7 @@ sub editgrades { my $header; while ($ctr < $env{'form.totalparts'}) { my $partid = $env{'form.partid_'.$ctr}; - push @partid,$partid; + push(@partid,$partid); $weight{$partid} = $env{'form.weight_'.$partid}; $ctr++; } @@ -6847,7 +6847,7 @@ ENDSCRIPT foreach my $question (@{$arg}) { my @linenums = &prompt_for_corrections($r,$question,$scan_config, $scan_record, $error); - push (@lines_to_correct,@linenums); + push(@lines_to_correct,@linenums); } $r->print(&verify_bubbles_checked(@lines_to_correct)); } elsif ($error eq 'missingbubble') { @@ -6867,7 +6867,7 @@ ENDSCRIPT foreach my $question (@{$arg}) { my @linenums = &prompt_for_corrections($r,$question,$scan_config, $scan_record, $error); - push (@lines_to_correct,@linenums); + push(@lines_to_correct,@linenums); } $r->print(&verify_bubbles_checked(@lines_to_correct)); } else { @@ -7025,7 +7025,7 @@ sub prompt_for_corrections { my $selected = $$scan_record{"scantron.$current_line.answer"}; &scantron_bubble_selector($r,$scan_config,$current_line, $questionnum,$error,split('', $selected)); - push (@linenums,$current_line); + push(@linenums,$current_line); $current_line++; } if ($lines > 1) { @@ -7241,7 +7241,7 @@ sub scantron_validate_CODE { $line,'duplicateCODE',$usedCODEs{$CODE}); return(1,$currentphase); } - push (@{$usedCODEs{$CODE}},$$scan_record{'scantron.PaperID'}); + push(@{$usedCODEs{$CODE}},$$scan_record{'scantron.PaperID'}); } return (0,$currentphase+1); } @@ -7375,7 +7375,7 @@ sub scantron_get_maxbubble { if (($analysis{$part_id.'.type'} eq 'essayresponse') || ($analysis{$part_id.'.type'} eq 'reactionresponse') || ($analysis{$part_id.'.type'} eq 'organicresponse')) { - push (@allparts,$part_id); + push(@allparts,$part_id); } } } @@ -8163,25 +8163,25 @@ sub grading_menu { }); $fields{'command'} = 'csvform'; $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push (@menu, { url => $url, + push(@menu, { url => $url, name => &mt('Upload Scores'), short_description => &mt('Specify a file containing the class scores for current resource.')}); $fields{'command'} = 'processclicker'; $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push (@menu, { url => $url, + push(@menu, { url => $url, name => &mt('Process Clicker'), short_description => &mt('Specify a file containing the clicker information for this resource.')}); $fields{'command'} = 'scantron_selectphase'; $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push (@menu, { url => $url, + push(@menu, { url => $url, name => &mt('Grade/Manage/Review Scantron Forms'), short_description => &mt('Grade scantron exams, upload/download scantron data files, and review previously graded scantron exams.')}); $fields{'command'} = 'verify'; $url = &Apache::lonhtmlcommon::build_url('grades/',\%fields); - push (@menu, { url => "", + push(@menu, { url => "", name => &mt('Verify Receipt'), short_description => &mt('')}); @@ -8337,7 +8337,7 @@ GRADINGMENUJS