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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 05 Sep 2007 00:22:24 -0000


albertel		Tue Sep  4 20:22:24 2007 EDT

  Modified files:              (Branch: version_2_5_X)
    /loncom/homework	grades.pm 
  Log:
  - backport 1.437,1.438
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.428.2.1 loncom/homework/grades.pm:1.428.2.2
--- loncom/homework/grades.pm:1.428.2.1	Fri Aug 24 03:15:27 2007
+++ loncom/homework/grades.pm	Tue Sep  4 20:22:20 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.428.2.1 2007/08/24 07:15:27 albertel Exp $
+# $Id: grades.pm,v 1.428.2.2 2007/09/05 00:22:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7072,9 +7072,10 @@
     # Set up a couple variables.
     my $username_idx = &Apache::loncoursedata::CL_SNAME();
     my $domain_idx   = &Apache::loncoursedata::CL_SDOM();
+    my $status_idx   = &Apache::loncoursedata::CL_STATUS();
 
     foreach my $student (keys(%$classlist)) {
-
+        if ($classlist->{$student}->[$status_idx] ne 'Active') { next; }
         my $username = $classlist->{$student}->[$username_idx];
         my $domain   = $classlist->{$student}->[$domain_idx];
         my $clickers =
@@ -7335,8 +7336,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}.'" />'.
@@ -7487,6 +7501,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) {