--- loncom/homework/caparesponse/caparesponse.pm 2007/06/06 17:03:54 1.216 +++ loncom/homework/caparesponse/caparesponse.pm 2008/02/01 23:00:56 1.221 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.216 2007/06/06 17:03:54 albertel Exp $ +# $Id: caparesponse.pm,v 1.221 2008/02/01 23:00:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -431,6 +431,10 @@ sub check_submission { &add_in_tag_answer($parstack,$safeeval); + if (!%answer) { + &Apache::lonxml::error("No answers are defined"); + } + my (@final_awards,@final_msgs,@names); foreach my $name (keys(%answer)) { &Apache::lonxml::debug(" doing $name with ".join(':',@{ $answer{$name}{'answers'} })); @@ -783,7 +787,16 @@ sub end_numericalresponse { } if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { - &Apache::lonxml::increment_counter($increment); + if (($tag eq 'formularesponse') && ($target eq 'analyze')) { + my $type = &Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.type'); + if ($type eq 'exam') { + $increment = &Apache::response::repetition(); + } + } + &Apache::lonxml::increment_counter($increment,"$partid.$id"); + if ($target eq 'analyze') { + &Apache::lonhomework::set_bubble_lines(); + } } &Apache::response::end_response(); return $result; @@ -1005,7 +1018,8 @@ sub get_sigrange { my ($sig)=@_; #&Apache::lonxml::debug("Got a sig of :$sig:"); my $courseid=$env{'request.course.id'}; - if (lc($env{"course.$courseid.disablesigfigs"}) eq 'yes') { + if ($env{'request.state'} ne 'construct' + && lc($env{"course.$courseid.disablesigfigs"}) eq 'yes') { return (15,0); } my $sig_lbound; @@ -1222,7 +1236,11 @@ sub end_stringresponse { } if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { - &Apache::lonxml::increment_counter(&Apache::response::repetition()); + &Apache::lonxml::increment_counter(&Apache::response::repetition(), + "$part.$id"); + if ($target eq 'analyze') { + &Apache::lonhomework::set_bubble_lines(); + } } &Apache::response::end_response; return $result;