--- loncom/homework/grades.pm 2011/10/09 16:23:34 1.656 +++ loncom/homework/grades.pm 2013/08/15 12:38:30 1.701 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.656 2011/10/09 16:23:34 raeburn Exp $ +# $Id: grades.pm,v 1.701 2013/08/15 12:38:30 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,6 +45,7 @@ use Apache::lonlocal; use Apache::lonenc; use Apache::lonstathelpers; use Apache::lonquickgrades; +use Apache::bridgetask(); use String::Similarity; use LONCAPA; @@ -53,6 +54,7 @@ use POSIX qw(floor); my %perm=(); +my %old_essays=(); # These variables are used to recover from ssi errors @@ -201,6 +203,7 @@ sub get_display_part { sub reset_caches { &reset_analyze_cache(); &reset_perm(); + &reset_old_essays(); } { @@ -340,7 +343,7 @@ sub cleanRecord { return '
'. ''.&mt('Answer').''.$toprow.''. ''.$grayFont.&mt('Option ID').''. - $grayFont.$bottomrow.''.'
'. ''.&mt('Answer').''.$toprow.''. ''.$grayFont.&mt('Option ID').''. - $bottomrow.''.'
@@ -6219,9 +6581,9 @@ sub scantron_warning_screen { '.&mt('Sequence to be Graded:').''.$title.' '.&mt('Data File that will be used:').''.$env{'form.scantron_selectfile'}.' -'.$CODElist.' +'.$CODElist.$lastbubblepoints.' - '.&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.','','').' @@ -6257,8 +6619,9 @@ sub scantron_do_warning { } } else { my $warning=&scantron_warning_screen('Grading: Validate Records',$symb); + my $bubbledbyhand=&hand_bubble_option(); $r->print(' -'.$warning.' +'.$warning.$bubbledbyhand.' '); @@ -6300,9 +6663,11 @@ SCANTRONFORM ''."\n"; $chunk .= ''."\n"; + $chunk .= + ''."\n"; $result .= $chunk; $line++; - } + } return $result; } @@ -6310,7 +6675,7 @@ SCANTRONFORM =item scantron_validate_file - Dispatch routine for doing validation of a bubble sheet data file. + Dispatch routine for doing validation of a bubblesheet data file. Also processes any necessary information resets that need to occur before validation begins (ignore previous corrections, @@ -6354,6 +6719,9 @@ sub scantron_validate_file { return ''; } my $result=&scantron_form_start($max_bubble).$default_form_data; + if ($env{'form.scantron_lastbubblepoints'} ne '') { + $result .= ''; + } $r->print($result); my @validate_phases=( 'sequence', @@ -6371,6 +6739,7 @@ sub scantron_validate_file { while (!$stop && $currentphase < scalar(@validate_phases)) { $r->print(&mt('Validating '.$validate_phases[$currentphase]).''); $r->rflush(); + my $which="scantron_validate_".$validate_phases[$currentphase]; { no strict 'refs'; @@ -6421,7 +6790,7 @@ sub scantron_validate_file { =item scantron_remove_file - Removes the requested bubble sheet data file, makes sure that + Removes the requested bubblesheet data file, makes sure that scantron_original_ is never removed @@ -6446,7 +6815,7 @@ sub scantron_remove_file { =item scantron_remove_scan_data - Removes all scan_data correction for the requested bubble sheet + Removes all scan_data correction for the requested bubblesheet data file. (In the case that both the are doing skipped records we need to remember the old skipped lines for the time being so that element persists for a while.) @@ -6483,7 +6852,7 @@ sub scantron_remove_scan_data { =item scantron_getfile - Fetches the requested bubble sheet data file (all 3 versions), and + Fetches the requested bubblesheet data file (all 3 versions), and the scan_data hash Arguments: @@ -6583,7 +6952,7 @@ sub lonnet_putfile { =item scantron_putfile - Stores the current version of the bubble sheet data files, and the + Stores the current version of the bubblesheet data files, and the scan_data hash. (Does not modify the original version only the corrected and skipped versions. @@ -6677,7 +7046,7 @@ sub get_todo_count { =item scantron_put_line - Updates the 'corrected' or 'skipped' versions of the bubble sheet + Updates the 'corrected' or 'skipped' versions of the bubblesheet data file. Arguments: @@ -6779,7 +7148,13 @@ sub scantron_validate_sequence { my @resources= $navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); if (@resources) { - $r->print("".&mt('Some resources in the sequence currently are not set to exam mode. Grading these resources currently may not work correctly.').""); + $r->print( + '' + .&mt('Some resources in the sequence currently are not set to' + .' bubblesheet exam mode. Grading these resources currently may not' + .' work correctly.') + .'' + ); return (1,$currentphase); } } @@ -6860,25 +7235,35 @@ sub scantron_validate_ID { sub scantron_get_correction { - my ($r,$i,$scan_record,$scan_config,$line,$error,$arg)=@_; + my ($r,$i,$scan_record,$scan_config,$line,$error,$arg, + $randomorder,$randompick,$respnumlookup,$startline)=@_; #FIXME in the case of a duplicated ID the previous line, probably need #to show both the current line and the previous one and allow skipping #the previous one or the current one if ( $$scan_record{'scantron.PaperID'} =~ /\S/) { - $r->print("".&mt("An error was detected ($error)". - " for PaperID [_1]", - $$scan_record{'scantron.PaperID'})." \n"); - } else { - $r->print("".&mt("An error was detected ($error)". - " in scanline [_1] [_2]", - $i,$line)."
'.&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 work correctly.')."
' + .&mt('Some resources in the sequence currently are not set to' + .' bubblesheet exam mode. Grading these resources currently may not' + .' work correctly.') + .'
".&mt("An error was detected ($error)". - " for PaperID [_1]", - $$scan_record{'scantron.PaperID'})."
".&mt("An error was detected ($error)". - " in scanline [_1]
[_2]
".&mt("The ID on the form is [_1]". - "The name on the paper is [_2],[_3]", - $$scan_record{'scantron.ID'}, - $$scan_record{'scantron.LastName'}, - $$scan_record{'scantron.FirstName'})."
' + .&mt('An error was detected ([_1]) for PaperID [_2]', + "$error", + ''.$$scan_record{'scantron.PaperID'}.'') + ."
' + .&mt('An error was detected ([_1]) in scanline [_2] [_3]', + "$error", $i, "
$line
' + .&mt('The ID on the form is [_1]', + "$$scan_record{'scantron.ID'}") + .'' + .&mt('The name on the paper is [_1], [_2]', + $$scan_record{'scantron.LastName'}, + $$scan_record{'scantron.FirstName'}) + .'
".&mt("The encoded ID is not in the classlist"). + $r->print('
'.&mt("The encoded ID is not in the classlist"). "
".&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."
'.&mt("The encoded ID has also been used by a previous paper [_1]",$arg)."
".&mt("How should I handle this?")." \n"); @@ -6901,20 +7286,21 @@ sub scantron_get_correction { $r->print(&Apache::loncommon::selectstudent_link('scantronupload', 'scantron_username','scantron_domain')); $r->print(": "); - $r->print("\n@". + $r->print("\n:\n". &Apache::loncommon::select_dom_form($env{'request.role.domain'},'scantron_domain')); $r->print(''); } elsif ($error =~ /CODE$/) { if ($error eq 'incorrectCODE') { - $r->print("
".&mt("The encoded CODE is not in the list of possible CODEs.")."
'.&mt("The encoded CODE is not in the list of possible CODEs.")."
".&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."
'.&mt("The encoded CODE has also been used by a previous paper [_1], and CODEs are supposed to be unique.",join(', ',@{$arg}))."
".&mt("The CODE on the form is '[_1]'", - $$scan_record{'scantron.CODE'})."\n"); + $r->print("
".&mt('The CODE on the form is [_1]', + "'$$scan_record{'scantron.CODE'}'") + ."
".&mt("How should I handle this?")." \n"); + $r->print("
".&mt("How should I handle this?")."
".&mt("There have been multiple bubbles scanned for some question(s)")."
'.&mt("There have been multiple bubbles scanned for some question(s)")."
".&mt("Please indicate which bubble should be used for grading")."
".&mt("There have been no bubbles scanned for some question(s)")."
'.&mt("There have been [_1]no[_2] bubbles scanned for some question(s)",'','')."
".&mt("Please indicate which bubble should be used for grading.")."
'. + &mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?',''). + ''.&mt('[quant,_1,point]',$bubbles_per_row).' '.&mt('or').' '. + '0 points
'); + $r->print(''); if ($scancode eq '') { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2].', $uname.':'.$udom,$scan_record->{'scantron.ID'})); } else { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2] and CODE: [_3].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2] and CODE: [_3].', $uname.':'.$udom,$scan_record->{'scantron.ID'},$scancode)); } $r->print(''.&Apache::loncommon::start_data_table()."\n". @@ -7837,12 +8443,12 @@ SCANTRONFORM '
'); if ($scancode eq '') { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2].', $uname.':'.$udom,$scan_record->{'scantron.ID'})); } else { - $r->print(&mt('Mismatch grading bubble sheet for user: [_1] with ID: [_2] and CODE: [_3].', + $r->print(&mt('Mismatch grading bubblesheet for user: [_1] with ID: [_2] and CODE: [_3].', $uname.':'.$udom,$scan_record->{'scantron.ID'},$scancode)); } $r->print(''.&Apache::loncommon::start_data_table()."\n". @@ -7837,12 +8443,12 @@ SCANTRONFORM '
- '.&mt('The requested file name was invalid.').' + '.&mt('The requested filename was invalid.').'
'.&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,'') + .'