I could not load scale question node and zero the nid and set is_new to save as new node. The scale questions would not be properly linked. The problem appears to be that when saving the scale question node saveAnswerCollection() expects the scale answers to be available at $node->alternativeX. However, getNodeProperties() did not properly load these values. The fix appears to be...

Replace lines 318-320 of scale.classes.inc

foreach ($res as $res_o) {
  $props[] = $res_o;
}

with this

/*** saveAnswerCollection() expects this to be 'alternativeX', so add the extra fields onto the node ***/
$x=0;
foreach ($res as $res_o) {
  $props[] = $res_o;
  $props['alternative'.$x] = $res_o->answer;
  ++$x;
}

Agree? Also any ideas if there might be similar problems with other question types?

Comments

webservant316 created an issue. See original summary.

djdevin’s picture

Category: Support request » Bug report
Status: Active » Closed (duplicate)
webservant316’s picture

Just noting that the link above to the duplicate issue only offers a patch for Quiz 5, but the solution suggested in this post work in my use case for Quiz 4.

webservant316’s picture

Upgraded to 7.x-4.0-rc7 and manually patched as indicated in the original post. Any chance of getting this fix into Quiz 4?