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

raeburn raeburn at source.lon-capa.org
Mon Feb 9 23:02:18 EST 2015


raeburn		Tue Feb 10 04:02:18 2015 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - If the same student ID is used more than one student in the classlist, 
    the username:domain belonging to the student with Active status is used.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.730 loncom/homework/grades.pm:1.731
--- loncom/homework/grades.pm:1.730	Fri Dec 19 12:18:02 2014
+++ loncom/homework/grades.pm	Tue Feb 10 04:02:17 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.730 2014/12/19 12:18:02 kruse Exp $
+# $Id: grades.pm,v 1.731 2015/02/10 04:02:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5714,7 +5714,9 @@
 =item username_to_idmap
 
     creates a hash keyed by student/employee ID with values of the corresponding
-    student username:domain.
+    student username:domain. If a single ID occurs for more than one student,
+    the status of the student is checked, and if Active, the value in the hash
+    will be set to the Active student.
 
   Arguments:
 
@@ -5732,8 +5734,17 @@
     my ($classlist)= @_;
     my %idmap;
     foreach my $student (keys(%$classlist)) {
-	$idmap{$classlist->{$student}->[&Apache::loncoursedata::CL_ID]}=
-	    $student;
+        my $id = $classlist->{$student}->[&Apache::loncoursedata::CL_ID];
+        unless ($id eq '') {
+            if (!exists($idmap{$id})) {
+                $idmap{$id} = $student;
+            } else {
+                my $status = $classlist->{$student}->[&Apache::loncoursedata::CL_STATUS];
+                if ($status eq 'Active') {
+                    $idmap{$id} = $student;
+                }
+            }
+        }
     }
     return %idmap;
 }




More information about the LON-CAPA-cvs mailing list