[LON-CAPA-cvs] cvs: loncom /misc refresh_courseids_db.pl

raeburn raeburn@source.lon-capa.org
Fri, 30 Jul 2010 17:46:12 -0000


raeburn		Fri Jul 30 17:46:12 2010 EDT

  Modified files:              
    /loncom/misc	refresh_courseids_db.pl 
  Log:
  - Improved checking for changes in required LON-CAPA version for a course.
  
  
Index: loncom/misc/refresh_courseids_db.pl
diff -u loncom/misc/refresh_courseids_db.pl:1.5 loncom/misc/refresh_courseids_db.pl:1.6
--- loncom/misc/refresh_courseids_db.pl:1.5	Thu Jul 29 17:44:45 2010
+++ loncom/misc/refresh_courseids_db.pl	Fri Jul 30 17:46:12 2010
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # The LearningOnline Network
 #
-# $Id: refresh_courseids_db.pl,v 1.5 2010/07/29 17:44:45 raeburn Exp $
+# $Id: refresh_courseids_db.pl,v 1.6 2010/07/30 17:46:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -304,11 +304,21 @@
                                 $courseinfo{'internal.'.$item};
                         }
                     }
-                    if ($reqdmajor ne '' && $reqdminor ne '') {
-                        $courseshash->{$chome}{$cid}{'releaserequired'} = $reqdmajor.'.'.$reqdminor;
-                    }
-                    if ($courseinfo{'internal.releaserequired'} ne $reqdmajor.'.'.$reqdminor) {
-                        $changes{'internal.releaserequired'} = $reqdmajor.'.'.$reqdminor;
+                    if ($reqdmajor eq '' && $reqdminor eq '') {
+                        if ($courseinfo{'internal.releaserequired'} ne '') {
+                            $changes{'internal.releaserequired'} = '';
+                        }
+                    } else {
+                        my $releasereq =  $reqdmajor.'.'.$reqdminor;
+                        $courseshash->{$chome}{$cid}{'releaserequired'} = $releasereq;
+                        if ($courseinfo{'internal.releaserequired'} eq '') {
+                            $changes{'internal.releaserequired'} = $releasereq;
+                        } else {
+                            if ($courseinfo{'internal.releaserequired'} ne $releasereq) {
+                        
+                                $changes{'internal.releaserequired'} = $releasereq;
+                            }
+                        }
                     }
                     if (keys(%changes)) {
                         if (&Apache::lonnet::put('environment',\%changes,$cdom,$cnum) eq 'ok') {