--- loncom/homework/grades.pm 2003/07/15 20:59:53 1.116 +++ loncom/homework/grades.pm 2003/07/16 19:28:08 1.117 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.116 2003/07/15 20:59:53 ng Exp $ +# $Id: grades.pm,v 1.117 2003/07/16 19:28:08 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2669,51 +2669,22 @@ LISTJAVASCRIPT sub getSymbMap { my ($request) = @_; my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db', - $ENV{'request.course.fn'}.'_parms.db',1, 1); + $ENV{'request.course.fn'}.'_parms.db'); $navmap->init(); - # End navmap using boilerplate - - my $iterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, undef, undef, 1, undef, 1); - my $depth = 1; - my $curRes = $iterator->next(); - my %symbx = (); my @titles = (); - my $minder=0; - my $seenBeginMap = 0; - while ($depth > 0 || !$seenBeginMap) { - if ($curRes == $iterator->BEGIN_MAP()) {$depth++; $seenBeginMap = 1; } - if ($curRes == $iterator->END_MAP()) { $depth--; } - - if (ref($curRes) && $curRes->is_map()) { - my ($mapUrl, $id, $resUrl) = split(/___/, $curRes->symb()); # check map contains at least one problem - my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps - - my $mapiterator = $navmap->getIterator($map->map_start(), - $map->map_finish()); - - my $mapdepth = 1; - my $countProblems = 0; - $mapiterator->next(); # skip the first BEGIN_MAP - my $mapcurRes = $mapiterator->next(); # for "current resource" - while ($mapdepth > 0) { - if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; } - if($mapcurRes == $mapiterator->END_MAP) { $mapdepth--; } - - if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) { - $countProblems++; - } - $mapcurRes = $mapiterator->next(); - } - if ($countProblems > 0) { - my $title = $curRes->compTitle(); - push @titles,$minder.'.'.$title; # minder, just in case two titles are identical - $symbx{$minder.'.'.$title} = $curRes->symb(); - $minder++; - } - } - $curRes = $iterator->next(); + my $minder = 0; + + # Gather every sequence that has problems. + my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, 1); + for my $sequence ($navmap->getById('0.0'), @sequences) { + if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { + my $title = $minder.'.'.$sequence->compTitle(); + push @titles, $title; # minder in case two titles are identical + $symbx{$title} = $sequence->symb(); + $minder++; + } } $navmap->untieHashes();