--- loncom/homework/grades.pm 2003/04/01 05:21:48 1.82
+++ loncom/homework/grades.pm 2003/04/04 23:35:17 1.83
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.82 2003/04/01 05:21:48 albertel Exp $
+# $Id: grades.pm,v 1.83 2003/04/04 23:35:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2924,47 +2924,56 @@ sub scantron_parse_scanline {
my $data=substr($line,0,$$scantron_config{'Qstart'}-1);
if ($$scantron_config{'CODElocation'} ne 0) {
if ($$scantron_config{'CODElocation'} < 0) {
- $record{'CODE'}=substr($data,$$scantron_config{'CODEstart'}-1,
- $$scantron_config{'CODElength'});
+ $record{'scantron.CODE'}=substr($data,$$scantron_config{'CODEstart'}-1,
+ $$scantron_config{'CODElength'});
} else {
#FIXME interpret first N questions
}
}
- $record{'ID'}=substr($data,$$scantron_config{'IDstart'}-1,
- $$scantron_config{'IDlength'});
+ $record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1,
+ $$scantron_config{'IDlength'});
my @alphabet=('A'..'Z');
my $questnum=0;
while ($questions) {
$questnum++;
my $currentquest=substr($questions,0,$$scantron_config{'Qlength'});
substr($questions,0,$$scantron_config{'Qlength'})='';
+ if (length($currentquest) < $$scantron_config{'Qlength'}) { next; }
my (@array)=split(/$$scantron_config{'Qon'}/,$currentquest);
if (scalar(@array) gt 2) {
#FIXME do something intelligent with double bubbles
- Apache->request->print("
Wha!!! ".scalar(@array).
- '-'.$questions.'-'.$currentquest.'-'.$questnum.
- '-'.length($questions).
- '-'.$line.'-'.length($line).'-'.
- '-'.$data.'-'.length($data).'-'.
- '
');
+ Apache->request->print("
Wha!!!
".scalar(@array). + '-'.$currentquest.'-'.$questnum.'
checking studnet -'.$id.'- againt -'.$scanID.'-'); + if (lc($id) eq lc($scanID)) { Apache->request->print('success');return $$idmap{$id}; } + } + return undef; +} + +sub scantron_filter { + my ($curres)=@_; + if (ref($curres) && $curres->is_problem() && !$curres->randomout) { + return 1; + } + return 0; } sub scantron_process_students { @@ -2978,6 +2987,10 @@ sub scantron_process_students { my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}"); 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); + my $map=$navmap->getResourceByUrl($sequence); + my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); + $r->print("geto ".scalar(@resources)."
doing studnet'.$uname.''); ($uname,$udom)=split(/:/,$uname); + &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs + &Apache::lonnet::appenv(%$scan_record); + $Apache::lonxml::debug=1; + &Apache::lonhomework::showhash(%ENV); + $Apache::lonxml::debug=0; + + foreach my $resource (@resources) { + my $result=&Apache::lonnet::ssi($resource->src(), + ('submitted' =>'scantron', + 'grade_target' =>'grade', + 'grade_username'=>$uname, + 'grade_domain' =>$udom, + 'grade_courseid'=>$ENV{'request.course.id'}, + 'grade_symb' =>$resource->symb())); + $r->print('
'. + $resource->symb().'-'. + $resource->src().'-'.'result is'.$result); + last; + } + &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs + &Apache::lonnet::delenv('scantron\.'); + last; #FIXME #get iterator for $sequence #foreach question 'submit' the students answer to the server