[LON-CAPA-cvs] cvs: modules /raeburn neutrinoharvest.pl

raeburn raeburn@source.lon-capa.org
Tue, 30 Nov 2010 04:47:42 -0000


raeburn		Tue Nov 30 04:47:42 2010 EDT

  Modified files:              
    /modules/raeburn	neutrinoharvest.pl 
  Log:
  - Bug 5531.
      - record LON-CAPA hostID where "neutrino bug" events occurred. 
  
  
Index: modules/raeburn/neutrinoharvest.pl
diff -u modules/raeburn/neutrinoharvest.pl:1.7 modules/raeburn/neutrinoharvest.pl:1.8
--- modules/raeburn/neutrinoharvest.pl:1.7	Tue Oct 26 15:03:57 2010
+++ modules/raeburn/neutrinoharvest.pl	Tue Nov 30 04:47:42 2010
@@ -220,6 +220,7 @@
                 $env{'request.symb'} = $symb;
                 $env{'form.grade_symb'} = $symb;
                 my %history= &Apache::lonnet::restore($symb,$cid,$studom,$stuname);
+                my %host = (); 
                 if (ref($strings{$symb}) eq 'ARRAY') {
                     my @tocheck;
                     foreach my $prefix (@{$strings{$symb}}) {
@@ -257,17 +258,22 @@
                                             }
                                         }
                                     }
+                                } elsif ($key =~ /^(\d+):host$/) {
+                                    my $hist = $1;
+                                    next if ($firstcorrect && $hist > $firstcorrect);
+                                    $host{$hist} = $history{"$hist:host"};
                                 }
                             }
                             if (@errors > 0) {
                                 $totalneutrinos ++;
                                 @errors =  sort {$a <=> $b} @errors;
+                                my @hosts = map { $host{$_}; } @errors;
                                 my $control_char_msg;
                                 if (@had_control_chars > 0) {
                                     @had_control_chars =  sort {$a <=> $b} @had_control_chars;
                                     $control_char_msg = ' (control chars detected in: '.join(',',@had_control_chars).')';
                                 }
-                                print $fh "$cid $stu ".join(',',@errors)."$control_char_msg vs $firstcorrect ||$correct|| $symb$prefix\n";
+                                print $fh "$cid $stu ".join(',',@errors)." [".join(',',@hosts)."] $control_char_msg vs $firstcorrect ||$correct|| $symb$prefix\n";
                             }
                         } elsif ($history{$prefix.'.awarddetail'} eq 'INCORRECT') {
                             push (@tocheck,$prefix);
@@ -339,17 +345,20 @@
                                                 }
                                             }
                                         }
+                                    } elsif ($key =~ /^(\d+):host$/) {
+                                        $host{$1} = $history{"$1:host"}; 
                                     }
                                 }
                                 if (@grade_errors > 0) {
                                     $totalwronggrade ++;
                                     @grade_errors =  sort {$a <=> $b} @grade_errors;
+                                    my @hosts = map { $host{$_}; } @grade_errors;
                                     my $control_char_msg;
                                     if (@had_control_chars > 0) {
                                         @had_control_chars =  sort {$a <=> $b} @had_control_chars;
                                         $control_char_msg = ' (control chars detected in: '.join(',',@had_control_chars).')';
                                     }
-                                    print $fhb "$cid $stu ".join(',',@grade_errors)."$control_char_msg ||$correct|| $symb$prefix\n";
+                                    print $fhb "$cid $stu ".join(',',@grade_errors)." [".join(',',@hosts)."] $control_char_msg ||$correct|| $symb$prefix\n";
                                 }
                             }
                             delete($env{'form.grade_retrieveanswers'});