--- loncom/homework/grades.pm 2004/09/29 15:04:50 1.219 +++ loncom/homework/grades.pm 2004/11/23 14:19:32 1.231 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.219 2004/09/29 15:04:50 www Exp $ +# $Id: grades.pm,v 1.231 2004/11/23 14:19:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,25 +91,6 @@ sub get_symb_and_url { return ($symb,$url); } -# --- Retrieve the fullname for a user. Return lastname, first middle --- -# --- Generation is attached next to the lastname if it exists. --- -sub get_fullname { - my ($uname,$udom) = @_; - my %name=&Apache::lonnet::get('environment', ['lastname','generation', - 'firstname','middlename'], - $udom,$uname); - my $fullname; - my ($tmp) = keys(%name); - if ($tmp !~ /^(con_lost|error|no_such_host)/i) { - $fullname = &Apache::loncoursedata::ProcessFullName - (@name{qw/lastname generation firstname middlename/}); - } else { - &Apache::lonnet::logthis('grades.pm: no name data for '.$uname. - '@'.$udom.':'.$tmp); - } - return $fullname; -} - #--- Format fullname, username:domain if different for display #--- Use anywhere where the student names are listed sub nameUserString { @@ -1404,14 +1385,15 @@ sub submission { my ($uname,$udom) = ($ENV{'form.student'},$ENV{'form.userdom'}); $udom = ($udom eq '' ? $ENV{'user.domain'} : $udom); #has form.userdom changed for a student? my $usec = &Apache::lonnet::getsection($udom,$uname,$ENV{'request.course.id'}); - $ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq ''; + $ENV{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $ENV{'form.fullname'} eq ''; my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } if (!&canview($usec)) { $request->print('Unable to view requested student.('. - $uname.$udom.$usec.$ENV{'request.course.id'}.')'); + $uname.'@'.$udom.' in section '.$usec.' in course id '. + $ENV{'request.course.id'}.')'); $request->print(&show_grading_menu_form($symb,$url)); return; } @@ -1688,10 +1670,17 @@ KEYWORDS $lastsubonly.='
'.
'
|
The encoded CODE has also been used by a previous paper ".join(', ',@{$arg}).", and CODEs are supposed to be unique
\n"); } - $r->print("The CODE on the form is ".
- $$scan_record{'scantron.CODE'}."
\n");
+ $r->print("
The CODE on the form is '".
+ $$scan_record{'scantron.CODE'}."'
\n");
$r->print("
The ID on the form is ".
$$scan_record{'scantron.ID'}."
\n");
$r->print("The name on the paper is ".
@@ -4466,7 +4454,14 @@ sub scantron_validate_CODE {
$scan_data);
my $CODE=$$scan_record{'scantron.CODE'};
my $error=0;
- if (!exists($allcodes{$CODE}) && !$$scan_record{'scantron.useCODE'}) {
+ if (!&Apache::lonnet::validCODE($CODE)) {
+ &scantron_get_correction($r,$i,$scan_record,
+ \%scantron_config,
+ $line,'incorrectCODE',\%allcodes);
+ return(1,$currentphase);
+ }
+ if (%allcodes && !exists($allcodes{$CODE})
+ && !$$scan_record{'scantron.useCODE'}) {
&scantron_get_correction($r,$i,$scan_record,
\%scantron_config,
$line,'incorrectCODE',\%allcodes);
@@ -4638,8 +4633,14 @@ SCANTRONFORM
if (exists($scan_record->{'scantron.CODE'}) &&
$scan_record->{'scantron.CODE'}) {
$form{'CODE'}=$scan_record->{'scantron.CODE'};
+ } else {
+ $form{'CODE'}='';
}
my $result=&Apache::lonnet::ssi($resource->src(),%form);
+ if ($result ne '') {
+ &Apache::lonnet::logthis("scantron grading error -> $result");
+ &Apache::lonnet::logthis("scantron grading error info name $uname domain $udom course $ENV{'request.course.id'} url ".$resource->src());
+ }
if (&Apache::loncommon::connection_aborted($r)) { last; }
}
$completedstudents{$uname}={'line'=>$line};
@@ -4652,7 +4653,6 @@ SCANTRONFORM
# my $lasttime = &Time::HiRes::time()-$start;
# $r->print("
took $lasttime
"); - $navmap->untieHashes(); $r->print(""); $r->print(&show_grading_menu_form($symb,$url)); return '';