--- loncom/homework/grades.pm 2003/04/11 17:57:37 1.84 +++ loncom/homework/grades.pm 2003/04/19 09:02:57 1.85 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.84 2003/04/11 17:57:37 ng Exp $ +# $Id: grades.pm,v 1.85 2003/04/19 09:02:57 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2982,6 +2982,7 @@ sub scantron_process_students { my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'}); my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}"); + my @scanlines=<$scanlines>; my $classlist=&Apache::loncoursedata::get_classlist(); my %idmap=&username_to_idmap($classlist); my $navmap=Apache::lonnavmaps::navmap->new($ENV{'request.course.fn'}.'.db',$ENV{'request.course.fn'}.'_parms.db',1, 1); @@ -2996,8 +2997,15 @@ SCANTRONFORM $r->print($result); my @delayqueue; + my $totalcorrect; + my $totalincorrect; + + my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, + 'Scantron Status','Scantron Progress',scalar(@scanlines)); + foreach my $line (@scanlines) { + my $studentcorrect; + my $studentincorrect; - foreach my $line (<$scanlines>) { chomp($line); my $scan_record=&scantron_parse_scanline($line,\%scantron_config); my ($uname,$udom); @@ -3007,13 +3015,15 @@ SCANTRONFORM } $r->print('
doing studnet'.$uname.''); ($uname,$udom)=split(/:/,$uname); - &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs + &Apache::lonnet::delenv('form.counter'); &Apache::lonnet::appenv(%$scan_record); +# &Apache::lonhomework::showhash(%ENV); $Apache::lonxml::debug=1; - &Apache::lonhomework::showhash(%ENV); - $Apache::lonxml::debug=0; + &Apache::lonxml::debug("line is $line"); + my $i=0; foreach my $resource (@resources) { + $i++; my $result=&Apache::lonnet::ssi($resource->src(), ('submitted' =>'scantron', 'grade_target' =>'grade', @@ -3021,13 +3031,30 @@ SCANTRONFORM 'grade_domain' =>$udom, 'grade_courseid'=>$ENV{'request.course.id'}, 'grade_symb' =>$resource->symb())); + my %score=&Apache::lonnet::restore($resource->symb(), + $ENV{'request.course.id'}, + $udom,$uname); + foreach my $part ($resource->{PARTS}) { + if ($score{'resource.'.$part.'.solved'} =~ /^correct/) { + $studentcorrect++; + $totalcorrect++; + } else { + $studentincorrect++; + $totalincorrect++; + } + } $r->print('
'. $resource->symb().'-'. $resource->src().'-'.'result is'.$result); - last; + &Apache::lonhomework::showhash(%score); + # if ($i eq 3) {last;} } - &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs + &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; #FIXME #get iterator for $sequence @@ -3036,6 +3063,7 @@ SCANTRONFORM # generate data to pass back that includes grade recevied #} } + $Apache::lonxml::debug=0; foreach my $delay (@delayqueue) { #FIXME #print out each delayed student with interface to select how @@ -3048,7 +3076,8 @@ SCANTRONFORM #FIXME # if delay queue exists 2 submits one to process delayed students one # to ignore delayed students, possibly saving the delay queue for later - + + $navmap->untieHashes(); } #-------- end of section for handling grading scantron forms ------- #