- Status changed to Closed: outdated
4 months ago 2:44pm 11 September 2024 - πΊπΈUnited States smustgrave
Since there hasn't been a follow up for over a month going to close out. If still needed for 7.0.x (D10.3 + D11) please reopen
Whenever Quiz questions are updated, existing quiz_question_relationship entities are being deleted rather than updated, and new relationship entities are created in its place. This appears to occur even if only minor things like weights are being changed.
function quiz_set_questions($quiz, $questions, $set_new_revision = FALSE) {
if ($set_new_revision) {
// Create a new Quiz VID, even if nothing changed.
$quiz->revision = 1;
node_save($quiz);
}
// Clear the existing relationships for this version.
db_delete('quiz_node_relationship')
->condition('parent_nid', $quiz->nid)
->condition('parent_vid', $quiz->vid)
->execute();
It would be more logical if the overview on node/%node/quiz/questions operated directly on the relationship entities, rather than the question entities. This would allow for targetted updating of only relationships which have actually changed and would update those relationships rather than creating new ones.
I'm having some trouble deciphering the logic in quiz_set_questions and the related quiz_update_quiz_question_relationship, the latter of which seems to aim to simply copy over existing relationships to new entities connected to a new node->vid, but first creates new entities, then right after updates them again with values that could've been inserted in the first place.
Closed: outdated
5.0
Code - Quiz core
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Since there hasn't been a follow up for over a month going to close out. If still needed for 7.0.x (D10.3 + D11) please reopen