fixed bug 654053

This commit is contained in:
JT Smith 2002-12-15 17:01:28 +00:00
parent 35b93e2373
commit dc4e5e6543

View file

@ -585,15 +585,17 @@ sub www_view {
my @questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_response my @questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_response
where Survey_id=".$_[0]->get("Survey_id")." and ((userId=$session{user}{userId} where Survey_id=".$_[0]->get("Survey_id")." and ((userId=$session{user}{userId}
and userId<>1) or (userId=1 and ipAddress='$session{env}{REMOTE_ADDR}'))"); and userId<>1) or (userId=1 and ipAddress='$session{env}{REMOTE_ADDR}'))");
@questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_question if ($#questions >= 0) {
where Survey_id=".$_[0]->get("Survey_id") @questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_question
." and Survey_questionId not in (".join(",",@questions).")"); where Survey_id=".$_[0]->get("Survey_id")
." and Survey_questionId not in (".join(",",@questions).")");
}
if ($#questions >= 0) { if ($#questions >= 0) {
$question = $_[0]->getCollateral("Survey_question","Survey_questionId", $question = $_[0]->getCollateral("Survey_question","Survey_questionId",
$questions[rand($#questions+1)]); $questions[rand($#questions+1)]);
} }
} }
if ($questionOrder eq "response") { if ($questionOrder eq "response" && $previousResponse->{Survey_answerId}) {
my ($responseDriver) = WebGUI::SQL->quickArray("select goto from Survey_answer where my ($responseDriver) = WebGUI::SQL->quickArray("select goto from Survey_answer where
Survey_answerId=".$previousResponse->{Survey_answerId}); Survey_answerId=".$previousResponse->{Survey_answerId});
if ($responseDriver) { if ($responseDriver) {
@ -602,7 +604,7 @@ sub www_view {
$questionOrder = "sequential"; $questionOrder = "sequential";
} }
} }
if ($questionOrder eq "sequential") { if ($questionOrder eq "sequential" && $previousResponse->{Survey_questionId}) {
my $previousQuestion = $_[0]->getCollateral("Survey_question","Survey_questionId", my $previousQuestion = $_[0]->getCollateral("Survey_question","Survey_questionId",
$previousResponse->{Survey_questionId}); $previousResponse->{Survey_questionId});
$previousQuestion->{sequenceNumber} = 0 unless($previousQuestion->{sequenceNumber}); $previousQuestion->{sequenceNumber} = 0 unless($previousQuestion->{sequenceNumber});
@ -655,9 +657,12 @@ sub www_view {
and ((userId=$session{user}{userId} and userId<>1) or and ((userId=$session{user}{userId} and userId<>1) or
(userId=1 and ipAddress='$session{env}{REMOTE_ADDR}')) (userId=1 and ipAddress='$session{env}{REMOTE_ADDR}'))
and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1"); and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1");
$output .= "<h1>".WebGUI::International::get(52,$namespace).": ".$correctCount."/".$questionCount if ($questionCount > 0) {
."<br/>".WebGUI::International::get(54,$namespace).": " $output .= "<h1>".WebGUI::International::get(52,$namespace).": "
.round(($correctCount/$questionCount)*100)."%</h1>"; .$correctCount."/".$questionCount
."<br/>".WebGUI::International::get(54,$namespace).": "
.round(($correctCount/$questionCount)*100)."%</h1>";
}
} }
} }
} else { } else {