--- loncom/homework/response.pm 2004/12/07 16:19:37 1.110 +++ loncom/homework/response.pm 2005/02/24 00:36:10 1.114 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.110 2004/12/07 16:19:37 albertel Exp $ +# $Id: response.pm,v 1.114 2005/02/24 00:36:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -130,9 +130,10 @@ sub setrandomnumber { $rndmod+=&Apache::lonnet::numval2($Apache::inputtags::response[-1]); } } else { - $rndmod=(&Apache::lonnet::numval3($Apache::inputtags::part) << 10); + my $shift=(4*scalar(@Apache::inputtags::responselist))%30; + $rndmod=(&Apache::lonnet::numval3($Apache::inputtags::part) << (($shift+15)%30)); if (defined($Apache::inputtags::response[-1])) { - $rndmod+=&Apache::lonnet::numval3($Apache::inputtags::response[-1]); + $rndmod+=(&Apache::lonnet::numval3($Apache::inputtags::response[-1]) << $shift ); } } if ($rndseed =~/([,:])/) { @@ -150,7 +151,7 @@ sub setrandomnumber { $rndseed=(($rndseed<<32)>>32); } } - &Apache::lonxml::debug("randseed $rndseed"); + &Apache::lonxml::debug("randseed $rndmod $rndseed"); &Apache::lonnet::setup_random_from_rndseed($rndseed); return ''; } @@ -430,13 +431,11 @@ sub end_responseparam { } sub start_parameter { - my $result = &start_responseparam(@_); - return $result; + return &start_responseparam(@_); } sub end_parameter { - my $result = &end_responseparam(@_); - return $result; + return &end_responseparam(@_); } sub reset_params { @@ -714,6 +713,19 @@ sub get_response_param { return $parameter; } +sub submitted { + my ($who)=@_; + + # when scatron grading any submission is a submission + if ($ENV{'form.submitted'} eq 'scantron') { return 1; } + # if the caller only cared if this was a scantron submission + if ($who eq 'scantron') { return 0; } + # if the Submit Answer button for this particular part was pressed + my $partid=$Apache::inputtags::part; + if (defined($ENV{'form.submit_'.$partid})) { return 1; } + # otherwise no submission occured + return 0; +} 1; __END__