--- loncom/homework/grades.pm 2012/11/09 15:31:42 1.676 +++ loncom/homework/grades.pm 2014/01/18 01:44:47 1.714 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.676 2012/11/09 15:31:42 goltermann Exp $ +# $Id: grades.pm,v 1.714 2014/01/18 01:44:47 raeburn 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('If this information is correct, please click on \'[_1]\'.',&mt($button_text)).' +
'.&mt("If this information is correct, please click on '[_1]'.",&mt($button_text)).' '.&mt('If something is incorrect, please return to [_1]Grade/Manage/Review Bubblesheets[_2] to start over.','','').'
' .&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.', '','').'
@@ -8470,11 +8910,20 @@ sub checkscantron_results { return ''; } my $map=$navmap->getResourceByUrl($sequence); + 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); - my (%grader_partids_by_symb,%grader_randomlists_by_symb); + my $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource); + if ($nav_error) { + $r->print(&navmap_errormsg()); + return ''; + } &graders_resources_pass(\@resources,\%grader_partids_by_symb, \%grader_randomlists_by_symb,$bubbles_per_row); - my ($uname,$udom); my (%scandata,%lastname,%bylast); $r->print(' @@ -8483,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); - my $nav_error; &scantron_get_maxbubble(\$nav_error,\%scantron_config); # Need the bubble lines array to parse. if ($nav_error) { $r->print(&navmap_errormsg()); @@ -8509,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; @@ -8523,13 +8971,40 @@ sub checkscantron_results { my $pid = $scan_record->{'scantron.ID'}; $lastname{$pid} = $scan_record->{'scantron.LastName'}; push(@{$bylast{$lastname{$pid}}},$pid); + my $usec = $classlist->{$uname}->[&Apache::loncoursedata::CL_SECTION]; + my $user = $uname.':'.$usec; + ($username,$domain)=split(/:/,$uname); + + my $scancode; + if ((exists($scan_record->{'scantron.CODE'})) && + (&Apache::lonnet::validCODE($scan_record->{'scantron.CODE'}))) { + $scancode = $scan_record->{'scantron.CODE'}; + } else { + $scancode = ''; + } + + my @mapresources = @resources; my $lastpos = $env{'form.scantron_maxbubble'}*$scantron_config{'Qlength'}; + my %respnumlookup=(); + my %startline=(); + if ($randomorder || $randompick) { + @mapresources = + &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$//; - ($username,$domain)=split(/:/,$uname); + my $counter = -1; - foreach my $resource (@resources) { + foreach my $resource (@mapresources) { my $parts; my $ressymb = $resource->symb(); if ((exists($grader_randomlists_by_symb{$ressymb})) || @@ -8544,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; } } @@ -8591,7 +9068,12 @@ sub checkscantron_results { $env{'form.scantron_maxbubble'}) .'
'.&mt('Exact matches for [quant,_1,student].',$passed).''.&mt('Discrepancies detected for [quant,_1,student].',$failed).'
' + .&mt('Exact matches for [_1][quant,_2,student][_3].','',$passed,'') + .'' + .&mt('Discrepancies detected for [_1][quant,_2,student][_3].','',$failed,'') + .'