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

raeburn raeburn at source.lon-capa.org
Sat Jun 29 12:27:40 EDT 2013


raeburn		Sat Jun 29 16:27:40 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	grades.pm 
  Log:
  - For 2.11.
    - Backport some additional changes in rev. 1.691 not included in original
      backport (1.596.2.12.2.16).
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596.2.12.2.16 loncom/homework/grades.pm:1.596.2.12.2.17
--- loncom/homework/grades.pm:1.596.2.12.2.16	Fri Jun 28 22:54:50 2013
+++ loncom/homework/grades.pm	Sat Jun 29 16:27:39 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.596.2.12.2.16 2013/06/28 22:54:50 raeburn Exp $
+# $Id: grades.pm,v 1.596.2.12.2.17 2013/06/29 16:27:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7629,7 +7629,7 @@
             } else {
                 $first = $first_bubble_line{$responsenum} + 1;
             }
-            my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
+            my @subans = split(/,/,$subdivided_bubble_lines{$responsenum});
             my $subcount = 1;
             while ($subcount<$subquestion) {
                 $first += $subans[$subcount-1];
@@ -7637,8 +7637,16 @@
             }
             $count = $subans[$subquestion-1];
         } else {
-	    $first   = $first_bubble_line{$question-1} + 1;
-	    $count   = $bubble_lines_per_response{$question-1};
+            my $responsenum = $question-1;
+            if (($randomorder || $randompick) && (ref($respnumlookup) eq 'HASH')) {
+                $responsenum = $respnumlookup->{$question-1};
+                if (ref($startline) eq 'HASH') {
+                    $first = $startline->{$question-1} + 1;
+                }
+            } else {
+                $first = $first_bubble_line{$responsenum} + 1;
+            }
+            $count   = $bubble_lines_per_response{$responsenum};
         }
         $last = $first+$count-1;
         push(@lines, ($first..$last));
@@ -7660,6 +7668,14 @@
    $scan_config - The scantron file configuration hash.
    $scan_record - Reference to the hash that has the the parsed scanlines.
    $error       - Type of error
+   $randomorder - True if randomorder in use.
+   $randompick  - True if randompick in use.
+   $respnumlookup - Reference to HASH mapping question numbers in bubble lines
+                    for current line to question number used for same question
+                    in "Master Seqence" (as seen by Course Coordinator).
+   $startline   - Reference to hash where key is question number (0 is first)
+                  and value is number of first bubble line for current student
+                  or code-based randompick and/or randomorder.
 
  Implicit inputs:
    %bubble_lines_per_response   - Starting line numbers for each question.
@@ -8092,7 +8108,7 @@
     foreach my $resource (@resources) {
         my $resid = $resource->id();
         my ($analysis,$parts) = &scantron_partids_tograde($resource,$cid,$uname,
-                                                          $udom,$bubbles_per_row);
+                                                          $udom,undef,$bubbles_per_row);
         if ((ref($analysis) eq 'HASH') && (ref($parts) eq 'ARRAY')) {
 	    foreach my $part_id (@{$parts}) {
                 my $lines;
@@ -8197,23 +8213,20 @@
     if (ref($map)) {
         $randomorder = $map->randomorder();
         $randompick = $map->randompick();
+        if ($randomorder || $randompick) {
+            $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
+            if ($nav_error) {
+                $r->print(&navmap_errormsg());
+                return(1,$currentphase);
+            }
+            &graders_resources_pass(\@resources,\%grader_partids_by_symb,
+                                    \%grader_randomlists_by_symb,$bubbles_per_row);
+        }
     } else {
         $r->print(&navmap_errormsg());
-        return '';
-    }
-    my $nav_error;
-    my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
-    if ($randomorder || $randompick) {
-        $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);
-        if ($nav_error) {
-            $r->print(&navmap_errormsg());
-            return '';
-        }
+        return(1,$currentphase);
     }
-    &graders_resources_pass(\@resources,\%grader_partids_by_symb,
-                            \%grader_randomlists_by_symb,$bubbles_per_row);
 
-    my ($uname,$udom);
 
     my $max_bubble=&scantron_get_maxbubble(\$nav_error,\%scantron_config);
     if ($nav_error) {
@@ -8249,7 +8262,7 @@
                     $first = $first_bubble_line{$responsenum};
                 }
                 if (!defined($first)) { next; }
-                my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
+                my @subans = split(/,/,$subdivided_bubble_lines{$responsenum});
                 my $subcount = 1;
                 while ($subcount<$subquestion) {
                     $first += $subans[$subcount-1];
@@ -9006,6 +9019,7 @@
         %grader_randomlists_by_symb,%orderedforcode);
     if (ref($map)) {
         $randomorder=$map->randomorder();
+        $randompick=$map->randompick();
     }
     my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
     my $nav_error = &get_master_seq(\@resources,\@master_seq,\%symb_to_resource);




More information about the LON-CAPA-cvs mailing list