--- loncom/interface/statistics/lonstathelpers.pm 2004/09/30 13:44:07 1.27 +++ loncom/interface/statistics/lonstathelpers.pm 2004/10/04 19:11:38 1.28 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstathelpers.pm,v 1.27 2004/09/30 13:44:07 matthew Exp $ +# $Id: lonstathelpers.pm,v 1.28 2004/10/04 19:11:38 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1108,13 +1108,15 @@ sub get_problem_data { $Partdata{$part}->{'_Options'}=$value; } elsif ($key eq 'concepts') { $Partdata{$part}->{'_Concepts'}=$value; + } elsif ($key eq 'items') { + $Partdata{$part}->{'_Items'}=$value; } elsif ($key =~ /^concept\.(.*)$/) { my $concept = $1; foreach my $foil (@$value) { $Partdata{$part}->{'_Foils'}->{$foil}->{'_Concept'}= $concept; } - } elsif ($key =~ /^(incorrect|answer|ans_low|ans_high)$/) { + } elsif ($key =~ /^(incorrect|answer|ans_low|ans_high|str_type)$/) { $Partdata{$part}->{$key}=$value; } } else { @@ -1126,13 +1128,51 @@ sub get_problem_data { } elsif ($key =~ /^foil\.value\.(.*)$/) { my $foil = $1; $Partdata{$part}->{'_Foils'}->{$foil}->{'value'}=$value; + } elsif ($key eq 'answercomputed') { + $Partdata{$part}->{'answercomputed'} = $value; } } } } + # Further debugging code + if (0) { + &Apache::lonnet::logthis('lonstathelpers::get_problem_data'); + &log_hash_ref(\%Partdata); + } return %Partdata; } +sub log_array_ref { + my ($arrayref,$prefix) = @_; + return if (ref($arrayref) ne 'ARRAY'); + if (! defined($prefix)) { $prefix = ''; }; + foreach my $v (@$arrayref) { + if (ref($v) eq 'ARRAY') { + &log_array_ref($v,$prefix.' '); + } elsif (ref($v) eq 'HASH') { + &log_hash_ref($v,$prefix.' '); + } else { + &Apache::lonnet::logthis($prefix.'"'.$v.'"'); + } + } +} + +sub log_hash_ref { + my ($hashref,$prefix) = @_; + return if (ref($hashref) ne 'HASH'); + if (! defined($prefix)) { $prefix = ''; }; + while (my ($k,$v) = each(%$hashref)) { + if (ref($v) eq 'ARRAY') { + &Apache::lonnet::logthis($prefix.'"'.$k.'" = array'); + &log_array_ref($v,$prefix.' '); + } elsif (ref($v) eq 'HASH') { + &Apache::lonnet::logthis($prefix.'"'.$k.'" = hash'); + &log_hash_ref($v,$prefix.' '); + } else { + &Apache::lonnet::logthis($prefix.'"'.$k.'" => "'.$v.'"'); + } + } +} #################################################### ####################################################