Skip to content

Commit

Permalink
Fixed export bug with question type "P" (multiple options with commen…
Browse files Browse the repository at this point in the history
…t) when "other" was selected. Also fixed minor error with naming of token fields (first_name to firstname).

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1042 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed May 22, 2004
1 parent 868e4d0 commit 0b9b2e3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions admin/export.php
Expand Up @@ -339,7 +339,7 @@
$debug="";
for ($i=0; $i<$fieldcount; $i++)
{
$debug.="\n";
$debug.="\n\n================================== [$i]\n";
$fieldinfo=mysql_field_name($dresult, $i);
if ($fieldinfo == "token")
{
Expand Down Expand Up @@ -410,6 +410,7 @@
$debug .= "FSID: $fsid $s FGID: $fgid $s FQID: $fqid\n";
if ($style == "abrev") //Print out abbreviated question title
{
$debug .= "Abbreviated:\n";
if (!$fqid) {$fqid = "0";}
$oldfqid=$fqid;
while (!in_array($fqid, $legitqs)) //checks that the qid exists in our list. If not, have to do some tricky stuff to find where qid ends and answer code begins:
Expand Down Expand Up @@ -438,9 +439,13 @@
}
else //Print out extended question title
{
$debug .= "Extended:\n";
if (!$fqid) {$fqid = 0;}
$oldfqid=$fqid;
$debug .= "FQID: $fqid $s OLDFQID: $oldfqid\n";
$debug .= "LEGIT QS:$s";
foreach($legitqs as $lq) {$debug .= "$lq $s";}
$debug .= "\n";
while (!in_array($fqid, $legitqs) && $fqid) //checks that the qid exists in our list
{
$fqid = substr($fqid, 0, strlen($fqid)-1); //keeps cutting off the end until it finds the real qid
Expand Down Expand Up @@ -479,10 +484,10 @@
{
echo "EXPORT ERROR - Debug Info Follows\n";
echo "FIRSTLINE: $firstline\n";
foreach ($legitqs as $lq) { echo "DEBUG UNUSED LEGIT QUESTIONS: $lq\n";}
echo "QUESTION TYPE: ".$qrow['type']."\n";
echo "Other Debug Info: $debug\n";
foreach ($origlegitqs as $olq) {echo "DEBUG ORIGINAL LEGIT QUESTIONS: $olq\n";}
foreach ($legitqs as $lq) { echo "DEBUG UNUSED LEGIT QUESTIONS: $lq\n\n";}
echo "QUESTION TYPE: ".$qrow['type']."\n\n";
echo "Other Debug Info: $debug\n\n";
foreach ($origlegitqs as $olq) {echo "DEBUG ORIGINAL LEGIT QUESTIONS: $olq\n\n";}
die("An Export Error Occurred With Field [$fieldinfo]");
}
}
Expand Down Expand Up @@ -574,6 +579,7 @@
$debug .= "LAST SELECT TO GET ACOUNT: $aq $s";
$thisacount = mysql_num_rows($ar);
if ($ftype == "P") {$thisacount=$thisacount*2;}
if ($ftype == "P" && $fother == "Y") {$thisacount++;}
if ($fother == "Y") {$thisacount++;}
$debug .= " $s SETTING THISACOUNT - $thisacount POSSIBLE ANSWERS TO QUESTION";
}
Expand Down Expand Up @@ -777,7 +783,7 @@
for ($i=0; $i<$fieldcount; $i++) //For each field, work out the QID
{
$debug .= "\n";
if (mysql_field_name($dresult, $i) != "id" && mysql_field_name($dresult, $i) != "datestamp" && mysql_field_name($dresult, $i) != "token" && mysql_field_name($dresult, $i) != "first_name" && mysql_field_name($dresult, $i) != "last_name" && mysql_field_name($dresult, $i) != "email" && mysql_field_name($dresult, $i) != "attribute_1" && mysql_field_name($dresult, $i) != "attribute_2")
if (mysql_field_name($dresult, $i) != "id" && mysql_field_name($dresult, $i) != "datestamp" && mysql_field_name($dresult, $i) != "token" && mysql_field_name($dresult, $i) != "firstname" && mysql_field_name($dresult, $i) != "lastname" && mysql_field_name($dresult, $i) != "email" && mysql_field_name($dresult, $i) != "attribute_1" && mysql_field_name($dresult, $i) != "attribute_2")
{
list($fsid, $fgid, $fqid) = split("X", mysql_field_name($dresult, $i));
}
Expand Down Expand Up @@ -881,6 +887,7 @@
$ar = mysql_query($aq) or die ("Couldnt' count answers to question<br />".$aq."<br />".mysql_error());
$thisacount = mysql_num_rows($ar);
if ($ftype == "P") {$thisacount=$thisacount*2;}
if ($ftype == "P" && $fother == "Y") {$thisacount++;}
if ($fother == "Y") {$thisacount++;}
}
if(!isset($usedanswers)) {$usedanswers=0;}
Expand Down

0 comments on commit 0b9b2e3

Please sign in to comment.