Hi,

When creating a Quiz node programmatically, I found an issue in quiz_insert. The has_userpoint and tid parameters are inverted in the query string and in the db_query call. So $tid is written in column `has_userpoint` and $node->has_userpoint in column `tid`.

The fix is simply to invert $tid and $node->has_userpoints in the db_query call at line 409 of quiz.module.

Comments

sivaji_ganesh_jojodae’s picture

Yeah that's right.

   $sql = "INSERT INTO {quiz_node_properties}
     (vid, nid, aid, number_of_random_questions, shuffle,
-      backwards_navigation, quiz_open, quiz_close, takes, time_limit, pass_rate, summary_pass, summary_default, quiz_always, feedback_time, tid, has_userpoints)
+      backwards_navigation, quiz_open, quiz_close, takes, time_limit, pass_rate, summary_pass, summary_default, quiz_always, feedback_time, has_userpoints, tid)
     VALUES(%d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, '%s', '%s', %d, %d, %d, %d)";

Fix has been committed to CVS quiz 3.x-dev, will be available in next 12 hours. Thank you for reporting.

sivaji_ganesh_jojodae’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

recidive’s picture

Version: 6.x-3.4 » 6.x-4.x-dev
Status: Closed (fixed) » Needs review

It seems this didn't get applied to 6.4 branch.

Patch attached.

recidive’s picture

StatusFileSize
new1.19 KB

Oops, forgot to attach the patch for 6.4.

Here it goes.

recidive’s picture

StatusFileSize
new953 bytes

My last patch was actually taken from HEAD.

Here is the patch to fix that in DRUPAL-6--4. I've changed the variable instead of the SQL, to keep inline with the column order in the db table.

sivaji_ganesh_jojodae’s picture

Status: Needs review » Fixed

Thanks committed to CVS.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.