--- loncom/homework/grades.pm 2013/06/28 22:54:50 1.596.2.12.2.16 +++ loncom/homework/grades.pm 2013/06/29 16:27:39 1.596.2.12.2.17 @@ -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 @@ sub questions_to_line_list { } 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 @@ sub questions_to_line_list { } $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 @@ for multi and missing bubble cases). $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 @@ sub scantron_get_maxbubble { 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 @@ sub scantron_validate_missingbubbles { 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 @@ sub scantron_validate_missingbubbles { $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 @@ sub checkscantron_results { %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);