--- loncom/interface/statistics/lonproblemanalysis.pm 2006/12/21 19:52:28 1.129 +++ loncom/interface/statistics/lonproblemanalysis.pm 2007/01/04 02:44:07 1.130 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.129 2006/12/21 19:52:28 albertel Exp $ +# $Id: lonproblemanalysis.pm,v 1.130 2007/01/04 02:44:07 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -636,11 +636,21 @@ sub numerical_determine_answers { $sdom); # make the key my $key = $partid.'.'.$respid; + # pick one of the possible answers + my $which = 'INTERNAL'; + if (!exists($analysis->{$key}{$which})) { + $which = (sort(keys(%{ $analysis->{$key} })))[0]; + } foreach my $item ('answer','unit','ans_high','ans_low') { - $correct->{$sname.':'.$sdom}->{$item} = - $analysis->{$key.'.'.$item}->[0]; + if (ref($analysis->{$key.'.'.$item}) eq 'ARRAY') { + $correct->{$sname.':'.$sdom}->{$item} = + $analysis->{$key.'.'.$item}[0]; + } else { + $correct->{$sname.':'.$sdom}->{$item} = + $analysis->{$key.'.'.$item}{$which}[0][0]; + } } - $answers{$analysis->{$key.'.answer'}->[0]}++; + $answers{$correct->{$sname.':'.$sdom}{'answer'}}++; &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, &mt('last student')); }