'."\n";
- $result.='Fullname: '.$ENV{'form.fullname'}.
- ' Username: '.$uname.
- ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').' '."\n";
+ $result.='Fullname: '.&nameUserString(undef,$ENV{'form.fullname'},$uname,$udom).' '."\n";
$result.=''."\n";
@@ -1528,17 +1541,21 @@ KEYWORDS
my %seen = ();
my @partlist;
+ my @gradePartRespid;
for (sort keys(%$handgrade)) {
my ($partid,$respid) = split(/_/);
next if ($seen{$partid} > 0);
$seen{$partid}++;
next if ($$handgrade{$_} =~ /:no$/ && $ENV{'form.lastSub'} =~ /^(hdgrade)$/);
push @partlist,$partid;
+ push @gradePartRespid,$partid.'.'.$respid;
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
}
$result=''."\n";
+ $result.=''."\n" if ($counter == 0);
my $ctr = 0;
while ($ctr < scalar(@partlist)) {
$result.=''."\n".
'
No.
'.
- '
Fullname (Username)
'."\n";
+ '
'.&nameUserString('header')."
\n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
@@ -2160,7 +2175,7 @@ sub viewgrades {
#--- call by previous routine to display each student
sub viewstudentgrade {
- my ($$url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
+ my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
my ($uname,$udom) = split(/:/,$student);
$student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
@@ -2216,8 +2231,9 @@ sub editgrades {
$title.='Section: '.$ENV{'form.section'}.''."\n";
my $result= '
'."\n";
- $result.= '
No.
'.
- '
Fullname (username)
'."\n";
+ $result.= '
'.
+ '
No.
'.
+ '
'.&nameUserString('header')."
\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -2276,8 +2292,7 @@ sub editgrades {
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= '
';
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
my $numcols=scalar(@partid)*4+2;
@@ -2495,7 +2510,6 @@ to this page if the data selected is ins
$javascript
ENDPICK
- $request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -2756,9 +2770,9 @@ LISTJAVASCRIPT
'
'.
'
'.
'
No.
'.
- '
Fullname (username)
'.
+ '
'.&nameUserString('header').'
'.
'
No.
'.
- '
Fullname (username)
';
+ '
'.&nameUserString('header').'
';
my (undef,undef,$fullname) = &getclasslist($getsec,'1');
my $ptr = 1;
@@ -2766,8 +2780,8 @@ LISTJAVASCRIPT
my ($uname,$udom) = split(/:/,$student);
$studentTable.=($ptr%2 == 1 ? '
');
+ if (lc($id) eq lc($scanID)) {
+ #Apache->request->print('success');
+ return $$idmap{$id};
+ }
}
return undef;
}
@@ -3303,6 +3325,18 @@ sub scantron_filter {
return 0;
}
+#FIXME I think I am doing this in the wrong order, I think it would be
+#better to make a several passes analyzing all of the lines in the
+#file for common errors wrong/invalid PID/username duplicated
+#PID/username, missing bubbles, double bubbles, missing/invalid CODE
+#and then get the instructor to fix all of these errors, then grade
+#the corrected one, I'll still need to catch error conditions, but
+#maybe most will taken care even before we start
+
+sub scantron_validate_file {
+ my ($r) = @_;
+}
+
sub scantron_process_students {
my ($r) = @_;
my (undef,undef,$sequence)=split(/___/,$ENV{'form.selectpage'});
@@ -3318,7 +3352,7 @@ sub scantron_process_students {
my $navmap=Apache::lonnavmaps::navmap->new($ENV{'request.course.fn'}.'.db',$ENV{'request.course.fn'}.'_parms.db',1, 1);
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- $r->print("geto ".scalar(@resources)." ");
+# $r->print("geto ".scalar(@resources)." ");
my $result= <
@@ -3327,29 +3361,36 @@ SCANTRONFORM
$r->print($result);
my @delayqueue;
- my $totalcorrect;
- my $totalincorrect;
-
+ my %completedstudents;
+
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,
'Scantron Status','Scantron Progress',scalar(@scanlines));
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
+ 'Processing first student');
+ my $start=&Time::HiRes::time();
foreach my $line (@scanlines) {
- my $studentcorrect;
- my $studentincorrect;
+ $r->print('
line is'.$line.'
');
chomp($line);
my $scan_record=&scantron_parse_scanline($line,\%scantron_config);
my ($uname,$udom);
- if ($uname=&scantron_find_student($scan_record,\%idmap)) {
+ unless ($uname=&scantron_find_student($scan_record,\%idmap)) {
+ &scantron_add_delay(\@delayqueue,$line,
+ 'Unable to find a student that matches',1);
+ next;
+ }
+ if (exists $completedstudents{$uname}) {
&scantron_add_delay(\@delayqueue,$line,
- 'Unable to find a student that matches');
+ 'Student '.$uname.' has multiple sheets',2);
+ next;
}
$r->print('
result is'.$result);
+# &Apache::lonhomework::showhash(%score);
# if ($i eq 3) {last;}
}
+ $completedstudents{$uname}={'line'=>$line};
+ } continue {
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::delenv('scantron\.');
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
- 'last student Who got a '.$studentcorrect.' correct and '.
- $studentincorrect.' incorrect. The class has gotten '.
- $totalcorrect.' correct and '.$totalincorrect.' incorrect');
- last;
+ 'last student');
+ #last;
#FIXME
#get iterator for $sequence
#foreach question 'submit' the students answer to the server
@@ -3393,7 +3434,11 @@ SCANTRONFORM
# generate data to pass back that includes grade recevied
#}
}
- $Apache::lonxml::debug=0;
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+ my $lasttime = &Time::HiRes::time()-$start;
+ $r->print("
took $lasttime
");
+
+ #$Apache::lonxml::debug=0;
foreach my $delay (@delayqueue) {
#FIXME
#print out each delayed student with interface to select how
@@ -3676,6 +3721,8 @@ sub handler {
}
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) {
$request->print(&scantron_selectphase($request));
+ } elsif ($command eq 'scantron_validate' && $perm{'mgr'}) {
+ $request->print(&scantron_validate_file($request));
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) {
$request->print(&scantron_process_students($request));
} elsif ($command) {