[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm

raeburn raeburn at source.lon-capa.org
Tue Apr 26 09:51:39 EDT 2016


raeburn		Tue Apr 26 13:51:39 2016 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  - Only need to ensure course's "temporary" MySQL tables for groupnames and 
    studentgroups are current if tables exist.
  - Remove two debug lines.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.197 loncom/interface/loncoursedata.pm:1.198
--- loncom/interface/loncoursedata.pm:1.197	Mon Apr 25 23:00:58 2016
+++ loncom/interface/loncoursedata.pm	Tue Apr 26 13:51:38 2016
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.197 2016/04/25 23:00:58 raeburn Exp $
+# $Id: loncoursedata.pm,v 1.198 2016/04/26 13:51:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1306,7 +1306,11 @@
     if ($cdom eq '' || $cnum eq '') {
         return 'error: invalid course';
     }
-    &ensure_tables_are_set_up($courseid);
+    &setup_table_names($courseid);
+    my @CurrentTables = &Apache::lonmysql::tables_in_db();
+    unless (grep(/^\Q$groupnames_table\E$/, at CurrentTables)) {
+        return;
+    }
     # Get the update time for the groupnames table
     my $getuserdir = 1;
     my $modifiedtime = &Apache::lonnet::GetFileTimestamp
@@ -1316,7 +1320,6 @@
     if ($tableinfo{'Update_time'}) {
         $updatetime = $tableinfo{'Update_time'};
     }
-    print STDERR "1. updatetime is ||$updatetime|| and modifidtime is ||$modifiedtime||\n"; 
     if (! defined($updatetime) || $modifiedtime > $updatetime) {
         my (%groups_in_sql,%removegroups,$addgroup);
         my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
@@ -1367,7 +1370,11 @@
         $cdom = $env{'course.'.$courseid.'.domain'};
         $cnum = $env{'course.'.$courseid.'.num'};
     }
-    &ensure_tables_are_set_up($courseid);
+    &setup_table_names($courseid);
+    my @CurrentTables = &Apache::lonmysql::tables_in_db();
+    unless (grep(/^\Q$students_groups_table\E$/, at CurrentTables)) {
+        return;
+    }
     # Get the update time for the groupnames table
     my $getuserdir = 1;
     my $modifiedtime = &Apache::lonnet::GetFileTimestamp
@@ -1377,7 +1384,6 @@
     if ($tableinfo{'Update_time'}) {
         $updatetime = $tableinfo{'Update_time'};
     }
-    print STDERR "2. updatetime is ||$updatetime|| and modifidtime is ||$modifiedtime||\n";
     if ((!defined($updatetime)) || ($modifiedtime > $updatetime)) {
         if (&Apache::lonmysql::drop_table($students_groups_table)) {
             if (&init_dbs($courseid)) {




More information about the LON-CAPA-cvs mailing list