Fixed a couple of crash bugs.

This commit is contained in:
JT Smith 2002-12-13 03:16:36 +00:00
parent 7abd558e09
commit 2e90dcdc25

View file

@ -391,7 +391,7 @@ sub www_editQuestion {
"addBooleanAnswer"=>WebGUI::International::get(25,$namespace), "addBooleanAnswer"=>WebGUI::International::get(25,$namespace),
"addFrequencyAnswer"=>WebGUI::International::get(26,$namespace), "addFrequencyAnswer"=>WebGUI::International::get(26,$namespace),
"addOpinionAnswer"=>WebGUI::International::get(27,$namespace), "addOpinionAnswer"=>WebGUI::International::get(27,$namespace),
"addQuestion"=>WebGUI::International::get(28,$namespace), #"addQuestion"=>WebGUI::International::get(28,$namespace),
"backToPage"=>WebGUI::International::get(745) "backToPage"=>WebGUI::International::get(745)
); );
$f->whatNext( $f->whatNext(
@ -605,13 +605,13 @@ sub www_view {
if ($questionOrder eq "sequential") { if ($questionOrder eq "sequential") {
my $previousQuestion = $_[0]->getCollateral("Survey_question","Survey_questionId", my $previousQuestion = $_[0]->getCollateral("Survey_question","Survey_questionId",
$previousResponse->{Survey_questionId}); $previousResponse->{Survey_questionId});
$previousQuestion->{sequenceNumber} = 1 unless($previousQuestion->{sequenceNumber}); $previousQuestion->{sequenceNumber} = 0 unless($previousQuestion->{sequenceNumber});
$question = WebGUI::SQL->quickHashRef("select * from Survey_question where Survey_id=" $question = WebGUI::SQL->quickHashRef("select * from Survey_question where Survey_id="
.$_[0]->get("Survey_id")." and sequenceNumber>".$previousQuestion->{sequenceNumber} .$_[0]->get("Survey_id")." and sequenceNumber>".$previousQuestion->{sequenceNumber}
." order by sequenceNumber"); ." order by sequenceNumber");
} }
} }
if ($question) { if ($question->{Survey_questionId}) {
$output .= $question->{question}; $output .= $question->{question};
$f = WebGUI::HTMLForm->new; $f = WebGUI::HTMLForm->new;
$f->hidden("func","respond"); $f->hidden("func","respond");
@ -822,7 +822,13 @@ sub www_viewStatisticalOverview {
($data) = WebGUI::SQL->quickArray("select count(*) from Survey_response ($data) = WebGUI::SQL->quickArray("select count(*) from Survey_response
where Survey_answerId=".$answer->{Survey_answerId}); where Survey_answerId=".$answer->{Survey_answerId});
$output .= '<td>'.$data.'</td>'; $output .= '<td>'.$data.'</td>';
$output .= '<td>'.round(($data/$totalResponses)*100).'</td>'; $output .= '<td>';
if ($totalResponses) {
$output .= round(($data/$totalResponses)*100);
} else {
$output .= '0';
}
$output .= '</td>';
$output .= '</tr>'; $output .= '</tr>';
} }
$sth->finish; $sth->finish;