--- loncom/interface/loncoursedata.pm 2003/02/14 21:02:05 1.47 +++ loncom/interface/loncoursedata.pm 2003/02/20 14:28:25 1.49 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: loncoursedata.pm,v 1.47 2003/02/14 21:02:05 matthew Exp $ +# $Id: loncoursedata.pm,v 1.49 2003/02/20 14:28:25 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -283,6 +283,9 @@ The returned structure is a hash referen 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. =cut @@ -312,12 +315,15 @@ sub get_sequence_assessment_data { my $symb = $curRes->symb(); my $src = $curRes->src(); # + my @Sequences; + my @Assessments; my @Nested_Sequences = (); # Stack of sequences, keeps track of depth my $top = { title => $title, symb => $symb, type => 'container', num_assess => 0, contents => [], }; + push (@Sequences,$top); push (@Nested_Sequences, $top); # # We need to keep track of which sequences contain homework problems @@ -339,6 +345,7 @@ sub get_sequence_assessment_data { contents => [], }; push (@{$currentmap->{'contents'}},$newmap); # this is permanent + push (@Sequences,$newmap); push (@Nested_Sequences, $newmap); # this is a stack next; } @@ -358,10 +365,11 @@ sub get_sequence_assessment_data { symb => $symb, type => 'assessment', }; + push(@Assessments,$assessment); push(@{$currentmap->{'contents'}},$assessment); $currentmap->{'num_assess'}++; } - return $top; + return ($top,\@Sequences,\@Assessments); } =pod @@ -1611,13 +1619,13 @@ sub get_current_state { my $value = join(':',map { &Apache::lonnet::escape($_); } @Parameters); # 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; untie(%cache); } } else { -# &Apache::lonnet::logthis('retrieving cached data '); + &Apache::lonnet::logthis('retrieving cached data '); if (tie(%cache,'GDBM_File',$cachefilename,&GDBM_READER(),0640)) { if (defined($symb)) { my $searchkey = $key.&Apache::lonnet::escape($symb); @@ -1628,7 +1636,10 @@ sub get_current_state { my $searchkey = '^'.$key.'(.*)$';#' while (my ($testkey,$params)=each(%cache)) { 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); } }