--- loncom/homework/lonhomework.pm 2003/05/16 19:01:27 1.129 +++ loncom/homework/lonhomework.pm 2003/05/19 21:05:23 1.130 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.129 2003/05/16 19:01:27 albertel Exp $ +# $Id: lonhomework.pm,v 1.130 2003/05/19 21:05:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -398,7 +398,7 @@ sub analyze { 'last problem'); my $subresult=&Apache::lonnet::ssi($request->uri, ('grade_target' => 'analyze'), - ('rndseed' => $i)); + ('rndseed' => $i+$rndseed)); &Apache::lonxml::debug(":$subresult:"); (my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); my %analyze=&Apache::lonnet::str2hash($subresult); @@ -421,16 +421,27 @@ sub analyze { foreach my $part (keys(%allparts)) { if (defined(@{ $overall{$part.'.answer'} })) { $request->print(''); + my %frequency; foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { - $request->print(''); + $frequency{join('\0',@{ $answer })}++; + } + foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) { + $request->print(''); } $request->print('
Part '.$part.'
'.join('',@{ $answer }). - '
'. + join('',split('\0',$answer)). + '('.$frequency{$answer}. + ')
'); } else { $request->print('

Part '.$part. - ' is not analyzabale at this time

'); + ' is not analyzable at this time

'); } } + if (scalar(keys(%allparts)) == 0 ) { + $request->print('

Found no analyzable parts in this problem, + currently only Numerical, Formula and String response + styles are supported.

'); + } &Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); &analyze_footer($request); &Apache::lonhomework::showhash(%overall); @@ -663,7 +674,7 @@ sub handler { &renderpage($request,$file); } elsif ($ENV{'form.problemmode'} eq 'EditXML') { &editxmlmode($request,$file); - } elsif ($ENV{'form.problemmode'} eq 'Answer Distribution') { + } elsif ($ENV{'form.problemmode'} eq 'Calculate answers') { &analyze($request,$file); } else { &renderpage($request,$file);