--- loncom/interface/lonnavmaps.pm 2004/09/14 18:05:30 1.289 +++ loncom/interface/lonnavmaps.pm 2004/09/15 21:10:11 1.290 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.289 2004/09/14 18:05:30 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.290 2004/09/15 21:10:11 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3905,6 +3905,16 @@ Returns the number of parts of the probl for single part problems, returns 1. For multipart, it returns the number of parts in the problem, not including psuedo-part 0. +=item * B(): + +Returns the total number of responses in the problem a student can answer. + +=item * B(): + +Returns a hash whose keys are the response types. The values are the number +of times each response type is used. This is for the I problem, not +just a single part. + =item * B(): Returns true if the problem is multipart, false otherwise. Use this instead @@ -3951,6 +3961,26 @@ sub countParts { return scalar(@{$parts}); # + $delta; } +sub countResponses { + my $self = shift; + my $count; + foreach my $part ($self->parts()) { + $count+= $self->responseIds($part); + } + return $count; +} + +sub responseTypes { + my $self = shift; + my %Responses; + foreach my $part ($self->parts()) { + foreach my $responsetype ($self->responseType($part)) { + $Responses{$responsetype}++ if (defined($responsetype)); + } + } + return %Responses; +} + sub multipart { my $self = shift; return $self->countParts() > 1;