version 1.128, 2003/05/16 17:41:17
|
version 1.130, 2003/05/19 21:05:23
|
Line 214 sub check_access {
|
Line 214 sub check_access {
|
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
if ( $tries eq '' ) { $tries = '0'; } |
if ( $tries eq '' ) { $tries = '0'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } |
if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/ |
# if (correct and show prob status) or excused then CANNOT_ANSWER |
&& lc($Apache::lonhomework::problemstatus) ne 'no') { |
if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/ |
|
&& |
|
lc($Apache::lonhomework::problemstatus) ne 'no') |
|
|| |
|
$Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) { |
$status = 'CANNOT_ANSWER'; |
$status = 'CANNOT_ANSWER'; |
} |
} |
} |
} |
Line 394 sub analyze {
|
Line 398 sub analyze {
|
'last problem'); |
'last problem'); |
my $subresult=&Apache::lonnet::ssi($request->uri, |
my $subresult=&Apache::lonnet::ssi($request->uri, |
('grade_target' => 'analyze'), |
('grade_target' => 'analyze'), |
('rndseed' => $i)); |
('rndseed' => $i+$rndseed)); |
&Apache::lonxml::debug(":$subresult:"); |
&Apache::lonxml::debug(":$subresult:"); |
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); |
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
my %analyze=&Apache::lonnet::str2hash($subresult); |
Line 417 sub analyze {
|
Line 421 sub analyze {
|
foreach my $part (keys(%allparts)) { |
foreach my $part (keys(%allparts)) { |
if (defined(@{ $overall{$part.'.answer'} })) { |
if (defined(@{ $overall{$part.'.answer'} })) { |
$request->print('<table><tr><td>Part '.$part.'</td></tr>'); |
$request->print('<table><tr><td>Part '.$part.'</td></tr>'); |
|
my %frequency; |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { |
$request->print('<tr><td>'.join('</td><td>',@{ $answer }). |
$frequency{join('\0',@{ $answer })}++; |
'</td></tr>'); |
} |
|
foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) { |
|
$request->print('<tr><td>'. |
|
join('</td><td>',split('\0',$answer)). |
|
'</td><td>('.$frequency{$answer}. |
|
')</td></tr>'); |
} |
} |
$request->print('</table>'); |
$request->print('</table>'); |
} else { |
} else { |
$request->print('<p>Part '.$part. |
$request->print('<p>Part '.$part. |
' is not analyzabale at this time</p>'); |
' is not analyzable at this time</p>'); |
} |
} |
} |
} |
|
if (scalar(keys(%allparts)) == 0 ) { |
|
$request->print('<p>Found no analyzable parts in this problem, |
|
currently only Numerical, Formula and String response |
|
styles are supported.</p>'); |
|
} |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); |
&analyze_footer($request); |
&analyze_footer($request); |
&Apache::lonhomework::showhash(%overall); |
&Apache::lonhomework::showhash(%overall); |
Line 659 sub handler {
|
Line 674 sub handler {
|
&renderpage($request,$file); |
&renderpage($request,$file); |
} elsif ($ENV{'form.problemmode'} eq 'EditXML') { |
} elsif ($ENV{'form.problemmode'} eq 'EditXML') { |
&editxmlmode($request,$file); |
&editxmlmode($request,$file); |
} elsif ($ENV{'form.problemmode'} eq 'Answer Distribution') { |
} elsif ($ENV{'form.problemmode'} eq 'Calculate answers') { |
&analyze($request,$file); |
&analyze($request,$file); |
} else { |
} else { |
&renderpage($request,$file); |
&renderpage($request,$file); |