[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /homework grades.pm

raeburn raeburn at source.lon-capa.org
Wed May 2 11:21:01 EDT 2012


raeburn		Wed May  2 15:21:01 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	grades.pm 
  Log:
  - Backport 1.663 
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596.2.12.2.2 loncom/homework/grades.pm:1.596.2.12.2.3
--- loncom/homework/grades.pm:1.596.2.12.2.2	Wed May  2 14:23:34 2012
+++ loncom/homework/grades.pm	Wed May  2 15:21:00 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.596.2.12.2.2 2012/05/02 14:23:34 raeburn Exp $
+# $Id: grades.pm,v 1.596.2.12.2.3 2012/05/02 15:21:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6392,6 +6392,12 @@
 	    '<tr><td><b>'.&mt('List of CODES to validate against:').'</b></td><td><tt>'.
 	    $env{'form.scantron_CODElist'}.'</tt></td></tr>';
     }
+    my $lastbubblepoints;
+    if ($env{'form.scantron_lastbubblepoints'} ne '') {
+        $lastbubblepoints =
+            '<tr><td><b>'.&mt('Hand-graded items: points from last bubble in row').'</b></td><td><tt>'.
+            $env{'form.scantron_lastbubblepoints'}.'</tt></td></tr>';
+    }
     return ('
 <p>
 <span class="LC_warning">
@@ -6400,7 +6406,7 @@
 <table>
 <tr><td><b>'.&mt('Sequence to be Graded:').'</b></td><td>'.$title.'</td></tr>
 <tr><td><b>'.&mt('Data File that will be used:').'</b></td><td><tt>'.$env{'form.scantron_selectfile'}.'</tt></td></tr>
-'.$CODElist.'
+'.$CODElist.$lastbubblepoints.'
 </table>
 <br />
 <p> '.&mt('If this information is correct, please click on \'[_1]\'.',&mt($button_text)).'</p>
@@ -6440,8 +6446,9 @@
 	} 
     } else {
 	my $warning=&scantron_warning_screen('Grading: Validate Records');
+        my $bubbledbyhand=&hand_bubble_option();
 	$r->print('
-'.$warning.'
+'.$warning.$bubbledbyhand.'
 <input type="submit" name="submit" value="'.&mt('Grading: Validate Records').'" />
 <input type="hidden" name="command" value="scantron_validate" />
 ');
@@ -6538,6 +6545,9 @@
         return '';
     }
     my $result=&scantron_form_start($max_bubble).$default_form_data;
+    if ($env{'form.scantron_lastbubblepoints'} ne '') {
+        $result .= '<input type="hidden" name="scantron_lastbubblepoints" value="'.$env{'form.scantron_lastbubblepoints'}.'" />';
+    }
     $r->print($result);
     
     my @validate_phases=( 'sequence',
@@ -7815,6 +7825,41 @@
     return (0,$currentphase+1);
 }
 
+sub hand_bubble_option {
+    my (undef, undef, $sequence) =
+        &Apache::lonnet::decode_symb($env{'form.selectpage'});
+    return if ($sequence eq '');
+    my $navmap = Apache::lonnavmaps::navmap->new();
+    unless (ref($navmap)) {
+        return;
+    }
+    my $needs_hand_bubbles;
+    my $map=$navmap->getResourceByUrl($sequence);
+    my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
+    foreach my $res (@resources) {
+        if (ref($res)) {
+            if ($res->is_problem()) {
+                my $partlist = $res->parts();
+                foreach my $part (@{ $partlist }) {
+                    my @types = $res->responseType($part);
+                    if (grep(/^(chem|essay|image|formula|math|string|functionplot)$/, at types)) {
+                        $needs_hand_bubbles = 1;
+                        last;
+                    }
+                }
+            }
+        }
+    }
+    if ($needs_hand_bubbles) {
+        my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
+        my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
+        return &mt('The sequence to be graded contains response types which are handgraded.').'<p>'.
+               &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?','<br />').
+               '<label><input type="radio" name="scantron_lastbubblepoints" value="'.$bubbles_per_row.'" checked="checked" />'.&mt('[quant,_1,point]',$bubbles_per_row).'</label> '.&mt('or').' '.
+               '<label><input type="radio" name="scantron_lastbubblepoints" value="0"/>0 points</label></p>';
+    }
+    return;
+}
 
 sub scantron_process_students {
     my ($r) = @_;
@@ -8110,6 +8155,9 @@
             if ($bubbles_per_row ne '') {
                 $form{'bubbles_per_row'} = $bubbles_per_row;
             }
+            if ($env{'form.scantron_lastbubblepoints'} ne '') {
+                $form{'scantron_lastbubblepoints'} = $env{'form.scantron_lastbubblepoints'};
+            }
             if (ref($parts) eq 'HASH') {
                 if (ref($parts->{$ressymb}) eq 'ARRAY') {
                     foreach my $part (@{$parts->{$ressymb}}) {




More information about the LON-CAPA-cvs mailing list