Navigation Menu

Skip to content

Commit

Permalink
Added consistency check for questions that do not have question type …
Browse files Browse the repository at this point in the history
…set (only likely to happen if import survey fails)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@206 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Apr 11, 2003
1 parent 80b25ee commit 9328b3d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions admin/activate.php
Expand Up @@ -52,9 +52,16 @@
$chacount=mysql_num_rows($charesult);
if (!$chacount > 0)
{
$failedcheck[]=array($chkrow['qid'], $chkrow['question']);
$failedcheck[]=array($chkrow['qid'], $chkrow['question'], " is a multiple answer style question but does not have any answers");
}
}
//NOW CHECK THAT ALL QUESTIONS HAVE A 'QUESTION TYPE' FIELD
$chkquery = "SELECT qid, question FROM questions WHERE sid={$_GET['sid']} AND type = ''";
$chkresult = mysql_query($chkquery) or die ("Couldn't check questions for missing types<br />$chkquery<br />".mysql_error());
while ($chkrow = mysql_fetch_array($chkresult))
{
$failedcheck[]=array($chkrow['qid'], $chkrow['question'], " does not have a question type set.");
}
if ($failedcheck)
{
echo "<table width='350' align='center'>\n";
Expand All @@ -70,8 +77,7 @@
echo "\t\t\t<ul>\n";
foreach ($failedcheck as $fc)
{
echo "\t\t\t\t<li>Question qid-{$fc[0]} (\"{$fc[1]}\") is a multiple answer style question "
."but does not have any answers.</li>\n";
echo "\t\t\t\t<li>Question qid-{$fc[0]} (\"{$fc[1]}\") {$fc[2]}</li>\n";
}
echo "\t\t\t</ul>\n";
echo "\t\t\tThe survey cannot be activated until these problems have been resolved.\n";
Expand Down

0 comments on commit 9328b3d

Please sign in to comment.