--- loncom/interface/statistics/lonstathelpers.pm 2006/05/30 12:46:50 1.53 +++ loncom/interface/statistics/lonstathelpers.pm 2008/09/14 15:16:29 1.55 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstathelpers.pm,v 1.53 2006/05/30 12:46:50 www Exp $ +# $Id: lonstathelpers.pm,v 1.55 2008/09/14 15:16:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,7 +86,7 @@ sub render_resource { ## Render the problem my ($base) = ($resource->src =~ m|^(.*/)[^/]*$|); $base="http://".$ENV{'SERVER_NAME'}.$base; - my ($src,$symb)=($resource->src,&escape($resource->symb)); + my ($src,$symb)=($resource->link,&escape($resource->shown_symb)); my $rendered_problem = &Apache::lonnet::ssi_body($src.'?symb='.$symb); $rendered_problem =~ s/<\s*form\s*/)|<\/nop>|g; @@ -171,8 +171,7 @@ sub problem_selector { if (scalar(@response_ids) > 1) { $seq_str .= &mt('response').' '.$respid; } - my $link = $res->src.'?symb='. - &escape($res->symb); + my $link = $res->link.'?symb='.&escape($res->shown_symb); $seq_str .= (' 'x2). qq{view}; $seq_str .= "\n"; @@ -329,8 +328,8 @@ sub new_accumulator { 'value="'.&escape($res->symb).'" />'. ' '.$res->compTitle.''. (' 'x2).'view'. + 'href="'.$res->link.'?symb='. + &escape($res->shown_symb).'">view'. ''.$/; } else { if (defined($target)) { @@ -736,11 +735,16 @@ sub get_answer { my ($prefix,$key,%Answer) = @_; my $returnvalue; if (exists($Answer{$key})) { - my $student_answer = $Answer{$key}->[0]; - if (! defined($student_answer)) { - $student_answer = $Answer{$key}->[1]; - } - $returnvalue = $student_answer; + if (ref($Answer{$key}) eq 'HASH') { + my $which = 'INTERNAL'; + if (!exists($Answer{$key}{$which})) { + $which = (sort(keys(%{ $Answer{$key} })))[0]; + } + my $student_answer = $Answer{$key}{$which}[0][0]; + $returnvalue = $student_answer; + } else { + &Apache::lonnet::logthis("error analyzing problem. got a answer of type ".ref($Answer{$key})); + } } else { if (exists($Answer{$prefix.'.shown'})) { # The response has foils