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

www lon-capa-cvs-allow@mail.lon-capa.org
Sun, 02 Sep 2007 01:59:58 -0000


www		Sat Sep  1 21:59:58 2007 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  More than one student in the same class registered the same clicker.
  
  That should not happen, but it does.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.436 loncom/homework/grades.pm:1.437
--- loncom/homework/grades.pm:1.436	Wed Aug 29 09:41:32 2007
+++ loncom/homework/grades.pm	Sat Sep  1 21:59:57 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.436 2007/08/29 13:41:32 albertel Exp $
+# $Id: grades.pm,v 1.437 2007/09/02 01:59:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7381,8 +7381,21 @@
           $result.="\n".'<input type="hidden" name="correct:'.$correct_count.':'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />';
           $correct_count++;
        } elsif ($clicker_ids{$id}) {
-          $result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />';
-          $student_count++;
+          if ($clicker_ids{$id}=~/\,/) {
+# More than one user with the same clicker!
+             $result.="\n<hr />".&mt('Clicker registered more than once').": <tt>".$id."</tt><br />";
+             $result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'.
+                           "<select name='multi".$id."'>";
+             foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) {
+                 $result.="<option value='".$reguser."'>".&Apache::loncommon::plainname(split(/\:/,$reguser)).' ('.$reguser.')</option>';
+             }
+             $result.='</select>';
+             $unknown_count++;
+          } else {
+# Good: found one and only one user with the right clicker
+             $result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />';
+             $student_count++;
+          }
        } else {
           $result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />";
           $result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'.
@@ -7533,6 +7546,8 @@
           my $id=$1;
           if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) {
              $user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id};
+          } elsif ($env{'form.multi'.$id}) {
+             $user=$env{'form.multi'.$id};
           }
        }
        if ($user) {