Diff for /loncom/interface/loncoursedata.pm between versions 1.47 and 1.49

version 1.47, 2003/02/14 21:02:05 version 1.49, 2003/02/20 14:28:25
Line 283  The returned structure is a hash referen Line 283  The returned structure is a hash referen
   response_ids => [12,14,16]       # only for assessment    response_ids => [12,14,16]       # only for assessment
 }  }
   
   Also returned are array references to the symbs and assessments contained
   in the sequence.
   
 $hash->{'contents'} is a reference to an array of hashes of the same structure.  $hash->{'contents'} is a reference to an array of hashes of the same structure.
   
 =cut  =cut
Line 312  sub get_sequence_assessment_data { Line 315  sub get_sequence_assessment_data {
     my $symb  = $curRes->symb();      my $symb  = $curRes->symb();
     my $src   = $curRes->src();      my $src   = $curRes->src();
     #      #
       my @Sequences; 
       my @Assessments;
     my @Nested_Sequences = ();   # Stack of sequences, keeps track of depth      my @Nested_Sequences = ();   # Stack of sequences, keeps track of depth
     my $top = { title    => $title,      my $top = { title    => $title,
                 symb     => $symb,                  symb     => $symb,
                 type     => 'container',                  type     => 'container',
                 num_assess => 0,                  num_assess => 0,
                 contents   => [], };                  contents   => [], };
       push (@Sequences,$top);
     push (@Nested_Sequences, $top);      push (@Nested_Sequences, $top);
     #      #
     # We need to keep track of which sequences contain homework problems      # We need to keep track of which sequences contain homework problems
Line 339  sub get_sequence_assessment_data { Line 345  sub get_sequence_assessment_data {
                            contents   => [],                             contents   => [],
                        };                         };
             push (@{$currentmap->{'contents'}},$newmap); # this is permanent              push (@{$currentmap->{'contents'}},$newmap); # this is permanent
               push (@Sequences,$newmap);
             push (@Nested_Sequences, $newmap); # this is a stack              push (@Nested_Sequences, $newmap); # this is a stack
             next;              next;
         }          }
Line 358  sub get_sequence_assessment_data { Line 365  sub get_sequence_assessment_data {
                            symb  => $symb,                             symb  => $symb,
                            type  => 'assessment',                             type  => 'assessment',
                        };                         };
           push(@Assessments,$assessment);
         push(@{$currentmap->{'contents'}},$assessment);          push(@{$currentmap->{'contents'}},$assessment);
         $currentmap->{'num_assess'}++;          $currentmap->{'num_assess'}++;
     }      }
     return $top;      return ($top,\@Sequences,\@Assessments);
 }  }
   
 =pod  =pod
Line 1611  sub get_current_state { Line 1619  sub get_current_state {
                 my $value = join(':',map { &Apache::lonnet::escape($_); }                   my $value = join(':',map { &Apache::lonnet::escape($_); } 
                                  @Parameters);                                   @Parameters);
                 # Store away the values                  # Store away the values
                 $cache{$key.&Apache::lonnet::escape($symb)}=$value;                  $cache{$key.&Apache::lonnet::escape($current_symb)}=$value;
             }              }
             $cache{$key.'time'}=$time_of_retrieval;              $cache{$key.'time'}=$time_of_retrieval;
             untie(%cache);              untie(%cache);
         }          }
     } else {      } else {
 #        &Apache::lonnet::logthis('retrieving cached data ');          &Apache::lonnet::logthis('retrieving cached data ');
         if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_READER(),0640)) {          if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_READER(),0640)) {
             if (defined($symb)) {              if (defined($symb)) {
                 my  $searchkey = $key.&Apache::lonnet::escape($symb);                  my  $searchkey = $key.&Apache::lonnet::escape($symb);
Line 1628  sub get_current_state { Line 1636  sub get_current_state {
                 my $searchkey = '^'.$key.'(.*)$';#'                  my $searchkey = '^'.$key.'(.*)$';#'
                 while (my ($testkey,$params)=each(%cache)) {                  while (my ($testkey,$params)=each(%cache)) {
                     if ($testkey =~ /$searchkey/) { # \Q \E?  May be necc.                      if ($testkey =~ /$searchkey/) { # \Q \E?  May be necc.
                         $student_data{&Apache::lonnet::unescape($1)} =                           my $tmpsymb = $1;
                           next if ($tmpsymb =~ 'time');
   #                        &Apache::lonnet::logthis('found '.$tmpsymb.':');
                           $student_data{&Apache::lonnet::unescape($tmpsymb)} = 
                             &make_into_hash($params);                              &make_into_hash($params);
                     }                      }
                 }                  }

Removed from v.1.47  
changed lines
  Added in v.1.49


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