--- loncom/homework/grades.pm 2012/12/18 18:03:40 1.682 +++ loncom/homework/grades.pm 2014/01/15 14:46:26 1.712 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.682 2012/12/18 18:03:40 raeburn Exp $ +# $Id: grades.pm,v 1.712 2014/01/15 14:46:26 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -736,7 +736,7 @@ sub most_similar { sub initialverifyreceipt { my ($request,$symb) = @_; &commonJSfunctions($request); - return '
'. &keywords_highlight($oessay). '
' + .&mt('Unable to accept last correction, an error occurred: [_1]', + $errmsg) + .'
-'.&mt('Please double check the information below before clicking on \'[_1]\'',&mt($button_text)).' +'.&mt("Please double check the information below before clicking on '[_1]'",&mt($button_text)).'
' .&mt('Some resources in the sequence currently are not set to' - .' exam mode. Grading these resources currently may not' + .' bubblesheet exam mode. Grading these resources currently may not' .' work correctly.') .'
".&mt("Please indicate which bubble should be used for grading")."
'.&mt('Uploading file to [_1]','"'.$coursedata{'description'}.'"').'
'. + &mt('A low percentage of matches results from one of the following:'). + '
'.&mt('Uploaded file contained no data').'
- '.&mt('The requested file name was invalid.').' + '.&mt('The requested filename was invalid.').'
- '.&mt('[_1]Original[_2] file as uploaded by the scantron office.', + '.&mt('[_1]Original[_2] file as uploaded by the bubblesheet office.', '','').'
@@ -8530,19 +8910,18 @@ sub checkscantron_results { return ''; } my $map=$navmap->getResourceByUrl($sequence); - my ($randomorder,@master_seq,%symb_to_resource); + my ($randomorder,$randompick,@master_seq,%symb_to_resource,%grader_partids_by_symb, + %grader_randomlists_by_symb,%orderedforcode); if (ref($map)) { $randomorder=$map->randomorder(); + $randompick=$map->randompick(); } my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0); - foreach my $resource (@resources) { - if (ref($resource)) { - my $ressymb = $resource->symb(); - push(@master_seq,$ressymb); - $symb_to_resource{$ressymb} = $resource; - } + my $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource); + if ($nav_error) { + $r->print(&navmap_errormsg()); + return ''; } - my (%grader_partids_by_symb,%grader_randomlists_by_symb); &graders_resources_pass(\@resources,\%grader_partids_by_symb, \%grader_randomlists_by_symb,$bubbles_per_row); my ($uname,$udom); @@ -8553,10 +8932,9 @@ sub checkscantron_results { my @delayqueue; my %completedstudents; - my $count=&Apache::grades::get_todo_count($scanlines,$scan_data); + my $count=&get_todo_count($scanlines,$scan_data); my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$count); - my ($username,$domain,$started,%ordered); - my $nav_error; + my ($username,$domain,$started); &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse. if ($nav_error) { $r->print(&navmap_errormsg()); @@ -8579,8 +8957,8 @@ sub checkscantron_results { my $scan_record= &Apache::grades::scantron_parse_scanline($line,$i,\%scantron_config, $scan_data); - unless ($uname=&Apache::grades::scantron_find_student($scan_record,$scan_data, - \%idmap,$i)) { + unless ($uname=&scantron_find_student($scan_record,$scan_data, + \%idmap,$i)) { &Apache::grades::scantron_add_delay(\@delayqueue,$line, 'Unable to find a student that matches',1); next; @@ -8593,10 +8971,6 @@ sub checkscantron_results { my $pid = $scan_record->{'scantron.ID'}; $lastname{$pid} = $scan_record->{'scantron.LastName'}; push(@{$bylast{$lastname{$pid}}},$pid); - my $lastpos = $env{'form.scantron_maxbubble'}*$scantron_config{'Qlength'}; - $scandata{$pid} = substr($line,$scantron_config{'Qstart'}-1,$lastpos); - chomp($scandata{$pid}); - $scandata{$pid} =~ s/\r$//; my $usec = $classlist->{$uname}->[&Apache::loncoursedata::CL_SECTION]; my $user = $uname.':'.$usec; ($username,$domain)=split(/:/,$uname); @@ -8610,11 +8984,25 @@ sub checkscantron_results { } my @mapresources = @resources; - if ($randomorder) { + my $lastpos = $env{'form.scantron_maxbubble'}*$scantron_config{'Qlength'}; + my %respnumlookup=(); + my %startline=(); + if ($randomorder || $randompick) { @mapresources = - &users_order($user,$scancode,$sequence,\@master_seq,\%ordered, - \%symb_to_resource); + &users_order($user,$scancode,$sequence,\@master_seq,\%symb_to_resource, + \%orderedforcode); + my $total = &get_respnum_lookups($sequence,$scan_data,\%idmap,$line, + $scan_record,\@master_seq,\%symb_to_resource, + \%grader_partids_by_symb,\%orderedforcode, + \%respnumlookup,\%startline); + if ($randompick && $total) { + $lastpos = $total*$scantron_config{'Qlength'}; + } } + $scandata{$pid} = substr($line,$scantron_config{'Qstart'}-1,$lastpos); + chomp($scandata{$pid}); + $scandata{$pid} =~ s/\r$//; + my $counter = -1; foreach my $resource (@mapresources) { my $parts; @@ -8631,7 +9019,9 @@ sub checkscantron_results { ($counter,my $recording) = &verify_scantron_grading($resource,$domain,$username,$cid,$counter, $scandata{$pid},$parts, - \%scantron_config,\%lettdig,$numletts); + \%scantron_config,\%lettdig,$numletts, + $randomorder,$randompick, + \%respnumlookup,\%startline); $record{$pid} .= $recording; } } @@ -8679,7 +9069,7 @@ sub checkscantron_results { .'
' - .&mt('Exact matches for [_1][quant,_2,student][_3].','',$passed,''). + .&mt('Exact matches for [_1][quant,_2,student][_3].','',$passed,'') .'' .&mt('Discrepancies detected for [_1][quant,_2,student][_3].','',$failed,'') .'