Diff for /loncom/interface/loncoursedata.pm between versions 1.1 and 1.2

version 1.1, 2002/07/09 15:43:49 version 1.2, 2002/07/17 12:38:25
Line 309  sub ProcessTopResourceMap { Line 309  sub ProcessTopResourceMap {
     ':'.$currentResourceID;      ':'.$currentResourceID;
     }      }
   
             # Get Parts for problem  
     my $meta=$hash{'src_'.$currentResourceID};      my $meta=$hash{'src_'.$currentResourceID};
   #            $cache->{$currentResourceID.':title'}=
   #                &Apache::lonnet::metdata($meta,'title');
               $cache->{$currentResourceID.':title'}=
                   $hash{'title_'.$currentResourceID};
   
               # Get Parts for problem
     foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {      foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
  if($_=~/^stores\_(\d+)\_tries$/) {   if($_=~/^stores\_(\d+)\_tries$/) {
     my $Part=&Apache::lonnet::metadata($meta,$_.'.part');      my $Part=&Apache::lonnet::metadata($meta,$_.'.part');
Line 322  sub ProcessTopResourceMap { Line 327  sub ProcessTopResourceMap {
                         $cache->{$currentSequence.':'.$currentResourceID.                          $cache->{$currentSequence.':'.$currentResourceID.
                                    ':parts'}.=':'.$Part;                                     ':parts'}.=':'.$Part;
                     }                      }
  }                      foreach (split(/\,/,
                                &Apache::lonnet::metadata($meta,'packages'))) {
                           if($_=~/^optionresponse\_($Part)\_(\w+)$/) {
                               if(defined($cache->{'OptionResponses'})) {
                                   $cache->{'OptionResponses'}.= ':::'.
                                       $hash{'src_'.$currentResourceID}.'::'.
                                       $hash{'title_'.$currentResourceID}.'::'.
                                       $Part.'::'.$Problem;
                               } else {
                                   $cache->{'OptionResponses'}=
                                       $hash{'src_'.$currentResourceID}.'::'.
                                       $hash{'title_'.$currentResourceID}.'::'.
                                       $Part.'::'.$Problem;
                               }
                           }
                       }
                   }
     }      }
  }   }
   
Line 336  sub ProcessTopResourceMap { Line 357  sub ProcessTopResourceMap {
  # Capture sequence information here   # Capture sequence information here
  $cache->{$currentSequence.':title'}=   $cache->{$currentSequence.':title'}=
     $hash{'title_'.$currentResourceID};      $hash{'title_'.$currentResourceID};
                   $cache->{$currentSequence.':source'}=
                       $hash{'src_'.$currentResourceID};
   
                 my $totalProblems=0;                  my $totalProblems=0;
                 foreach my $currentProblem (split(/\:/,                  foreach my $currentProblem (split(/\:/,
Line 442  sub ProcessSection { Line 465  sub ProcessSection {
     if($key eq $courseid.'_st') {      if($key eq $courseid.'_st') {
  $section='';   $section='';
     }      }
   
     my ($dummy,$end,$start)=split(/\_/,$value);      my ($dummy,$end,$start)=split(/\_/,$value);
     my $now=time;      my $now=time;
     my $notactive=0;              my $notactive=0;
     if ($start) {              if ($start) {
  if($now<$start) {                  if($now<$start) {
     $notactive=1;                      $notactive=1;
  }                  }
     }              }
     if($end) {              if($end) {
  if ($now>$end) {                  if ($now>$end) {
     $notactive=1;                      $notactive=1;
  }                  }
     }              }
     if($notactive == 0) {              if($notactive == 0) {
  $status='Active';                  $status='Active';
  $cursection=$section;                  $cursection=$section;
  last;                  last;
     }              }
     if($notactive == 1) {              if($notactive == 1) {
  $oldsection=$section;                  $oldsection=$section;
     }              }
  }   }
     }      }
     if($status eq $ActiveFlag) {      if($status eq $ActiveFlag) {
  if($cursection eq '-1') {          if($cursection eq '-1') {
     return $oldsection;              return $oldsection;
  }          }
  return $cursection;          return $cursection;
     }      }
     if($ActiveFlag eq 'Any') {      if($ActiveFlag eq 'Any') {
  if($cursection eq '-1') {          if($cursection eq '-1') {
     return $oldsection;              return $oldsection;
  }          }
  return $cursection;          return $cursection;
     }      }
     return '-1';      return '-1';
 }  }
Line 539  sub ProcessStudentNamePIDSection { Line 563  sub ProcessStudentNamePIDSection {
  $cache->{$name.':id'}=$studentInformation->{'id'};   $cache->{$name.':id'}=$studentInformation->{'id'};
     }      }
   
     # Get student's section number  
     my $sec=&ProcessSection($section, $courseID, $status);      my $sec=&ProcessSection($section, $courseID, $status);
     if($sec != -1) {      if($sec != -1) {
  $cache->{$name.':section'}=$sec;          $cache->{$name.':section'}=$sec;
     } else {      } else {
  $cache->{$name.':section'}='';          $cache->{$name.':section'}='';
     }      }
   
     return;      return;
Line 792  sub TestCacheData { Line 815  sub TestCacheData {
     return $isCached;      return $isCached;
 }  }
   
   #sub CheckStatus {
   #    my ($name, $data, $status)=@_;
   
   #    if($status eq 'Any') {
   #        my $section = ' ';
   #        foreach (split(':',$data->{$name.':Sections'})) {
   #            if($data->{$name.':'.$_.'Status'} eq 'Active') {
   #                return $_;
   #            }
   #            $section = $_;
   #        }
   #        return $_;
   #    }
   
   #    foreach (split(':',$data->{$name.':Sections'})) {
   #        if($data->{$name.':'.$_.'Status'} eq $status) {
   #            return $_;
   #        }
   #    }
   
   #    foreach (split(':',$data->{$name.':Sections'})) {
   #        if($data->{$name.':'.$_.'Status'} eq 'Any') {
   #            return $_;
   #        }
   #    }
   
   #    return 'not found';
   #}
   
 # ----- END HELPER FUNCTIONS --------------------------------------------  # ----- END HELPER FUNCTIONS --------------------------------------------
   
 1;  1;

Removed from v.1.1  
changed lines
  Added in v.1.2


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