--- loncom/homework/inputtags.pm 2003/04/08 15:18:45 1.91 +++ loncom/homework/inputtags.pm 2003/04/19 09:00:54 1.92 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.91 2003/04/08 15:18:45 sakharuk Exp $ +# $Id: inputtags.pm,v 1.92 2003/04/19 09:00:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -252,6 +252,9 @@ sub finalizeawards { foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} } } if ($result eq '' ) { + foreach $award (@_) { if ($award eq 'ASSIGNED_SCORE') {$result=$award; last;} } + } + if ($result eq '' ) { foreach $award (@_) { if ($award eq 'APPROX_ANS') {$result=$award; last;} } } if ($result eq '' ) { $result='EXACT_ANS'; } @@ -267,12 +270,15 @@ sub decideoutput { if ($previous) { $previousmsg='You have entered that answer before'; } if ($solved =~ /^correct/) { - if ($target eq 'tex') { - $message = '\textbf{You are correct}. Your receipt is '. - &Apache::lonnet::receipt; + if ($award eq 'ASSIGNED_SCORE') { + $message = "A score has been assigned."; } else { - $message = "You are correct. Your receipt is ". - &Apache::lonnet::receipt; + if ($target eq 'tex') { + $message = '\textbf{You are correct}.'; + } else { + $message = "You are correct."; + } + $message=' Your receipt is '.&Apache::lonnet::receipt; } $button=0; $previousmsg=''; @@ -332,6 +338,9 @@ sub decideoutput { } elsif ($award eq 'DRAFT') { $message = "A draft copy has been saved."; $button=1; + } elsif ($award eq 'ASSIGNED_SCORE') { + $message = "A score has been assigned."; + $button=0; } else { $message = "Unknown message: $award"; $button=1; @@ -366,7 +375,19 @@ sub setgradedata { if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) { $Apache::lonhomework::results{"resource.$id.afterduedate"}=''; } - if ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) { + if ( $award eq 'ASSIGNED_SCORE') { + $Apache::lonhomework::results{"resource.$id.tries"} = + $Apache::lonhomework::history{"resource.$id.tries"} + 1; + $Apache::lonhomework::results{"resource.$id.solved"} = + 'correct_by_student'; + my $numawards=scalar(@Apache::inputtags::response); + $Apache::lonhomework::results{"resource.$id.awarded"} = 0; + foreach my $res (@Apache::inputtags::response) { + $Apache::lonhomework::results{"resource.$id.awarded"}+= + $Apache::lonhomework::results{"resource.$id.$res.awarded"}; + } + $Apache::lonhomework::results{"resource.$id.awarded"}/=$numawards; + } elsif ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) { $Apache::lonhomework::results{"resource.$id.tries"} = $Apache::lonhomework::history{"resource.$id.tries"} + 1; $Apache::lonhomework::results{"resource.$id.solved"} =