Diff for /loncom/interface/loncoursedata.pm between versions 1.197 and 1.199

version 1.197, 2016/04/25 23:00:58 version 1.199, 2016/07/24 14:34:59
Line 1306  sub ensure_current_groups { Line 1306  sub ensure_current_groups {
     if ($cdom eq '' || $cnum eq '') {      if ($cdom eq '' || $cnum eq '') {
         return 'error: invalid course';          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$/,@CurrentTables)) {
           return;
       }
     # Get the update time for the groupnames table      # Get the update time for the groupnames table
     my $getuserdir = 1;      my $getuserdir = 1;
     my $modifiedtime = &Apache::lonnet::GetFileTimestamp      my $modifiedtime = &Apache::lonnet::GetFileTimestamp
Line 1316  sub ensure_current_groups { Line 1320  sub ensure_current_groups {
     if ($tableinfo{'Update_time'}) {      if ($tableinfo{'Update_time'}) {
         $updatetime = $tableinfo{'Update_time'};          $updatetime = $tableinfo{'Update_time'};
     }      }
     print STDERR "1. updatetime is ||$updatetime|| and modifidtime is ||$modifiedtime||\n";   
     if (! defined($updatetime) || $modifiedtime > $updatetime) {      if (! defined($updatetime) || $modifiedtime > $updatetime) {
         my (%groups_in_sql,%removegroups,$addgroup);          my (%groups_in_sql,%removegroups,$addgroup);
         my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);          my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
Line 1367  sub ensure_current_students_groups { Line 1370  sub ensure_current_students_groups {
         $cdom = $env{'course.'.$courseid.'.domain'};          $cdom = $env{'course.'.$courseid.'.domain'};
         $cnum = $env{'course.'.$courseid.'.num'};          $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$/,@CurrentTables)) {
           return;
       }
     # Get the update time for the groupnames table      # Get the update time for the groupnames table
     my $getuserdir = 1;      my $getuserdir = 1;
     my $modifiedtime = &Apache::lonnet::GetFileTimestamp      my $modifiedtime = &Apache::lonnet::GetFileTimestamp
Line 1377  sub ensure_current_students_groups { Line 1384  sub ensure_current_students_groups {
     if ($tableinfo{'Update_time'}) {      if ($tableinfo{'Update_time'}) {
         $updatetime = $tableinfo{'Update_time'};          $updatetime = $tableinfo{'Update_time'};
     }      }
     print STDERR "2. updatetime is ||$updatetime|| and modifidtime is ||$modifiedtime||\n";  
     if ((!defined($updatetime)) || ($modifiedtime > $updatetime)) {      if ((!defined($updatetime)) || ($modifiedtime > $updatetime)) {
         if (&Apache::lonmysql::drop_table($students_groups_table)) {          if (&Apache::lonmysql::drop_table($students_groups_table)) {
             if (&init_dbs($courseid)) {              if (&init_dbs($courseid)) {
Line 2392  sub CL_STATUS   { return 7; } Line 2398  sub CL_STATUS   { return 7; }
 sub CL_TYPE     { return 8; }  sub CL_TYPE     { return 8; }
 sub CL_LOCKEDTYPE   { return 9; }  sub CL_LOCKEDTYPE   { return 9; }
 sub CL_CREDITS  { return 10; }  sub CL_CREDITS  { return 10; }
 sub CL_GROUP    { return 11; }  sub CL_INSTSEC { return 11; }
 sub CL_PERMANENTEMAIL { return 12; }  sub CL_GROUP    { return 12; }
 sub CL_ROLE     { return 13; }  sub CL_PERMANENTEMAIL { return 13; }
 sub CL_EXTENT   { return 14; }  sub CL_ROLE     { return 14; }
 sub CL_PHOTO   { return 15; }  sub CL_EXTENT   { return 15; }
 sub CL_THUMBNAIL { return 16; }  sub CL_PHOTO   { return 16; }
 sub CL_AUTHORQUOTA { return 17; }  sub CL_THUMBNAIL { return 17; }
 sub CL_AUTHORUSAGE { return 18; }  sub CL_AUTHORQUOTA { return 18; }
   sub CL_AUTHORUSAGE { return 19; }
   
 sub get_classlist {  sub get_classlist {
     my ($cdom,$cnum) = @_;      my ($cdom,$cnum) = @_;
Line 2419  sub get_classlist { Line 2426  sub get_classlist {
         }          }
         my ($sname,$sdom) = split(/:/,$student);          my ($sname,$sdom) = split(/:/,$student);
         my @Values = split(/:/,$info);          my @Values = split(/:/,$info);
         my ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits);          my ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits,$instsec);
         if (@Values > 2) {          if (@Values > 2) {
             ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits) = @Values;              ($end,$start,$id,$section,$fullname,$type,$lockedtype,$credits,$instsec) = @Values;
         } else { # We have to get the data ourselves          } else { # We have to get the data ourselves
             ($end,$start) = @Values;              ($end,$start) = @Values;
             $section = &Apache::lonnet::getsection($sdom,$sname,$cid);              $section = &Apache::lonnet::getsection($sdom,$sname,$cid);
Line 2461  sub get_classlist { Line 2468  sub get_classlist {
         }          }
         $classlist{$student} =           $classlist{$student} = 
             [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,              [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,
              $lockedtype,$credits];               $lockedtype,$credits,$instsec];
     }      }
     if (wantarray()) {      if (wantarray()) {
         return (\%classlist,['domain','username','end','start','id',          return (\%classlist,['domain','username','end','start','id',
                              'section','fullname','status','type',                               'section','fullname','status','type',
                              'lockedtype','credits']);                               'lockedtype','credits','instsec']);
     } else {      } else {
         return \%classlist;          return \%classlist;
     }      }
Line 3197  $env{'course.'.$cid.'.domain'}, and $env Line 3204  $env{'course.'.$cid.'.domain'}, and $env
 Returns a reference to a hash which contains:  Returns a reference to a hash which contains:
  keys    '$sname:$sdom'   keys    '$sname:$sdom'
  values  [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,   values  [$sdom,$sname,$end,$start,$id,$section,$fullname,$status,$type,
           $lockedtype,$credits]            $lockedtype,$credits,$instsec]
   
 The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used  The constant values CL_SDOM, CL_SNAME, CL_END, etc. can be used
 as indices into the returned list to future-proof clients against  as indices into the returned list to future-proof clients against

Removed from v.1.197  
changed lines
  Added in v.1.199


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>