Closed (fixed)
Project:
Quiz
Version:
7.x-5.x-dev
Component:
Code - Quiz core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Dec 2016 at 03:53 UTC
Updated:
22 Mar 2017 at 14:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joelpittetComment #3
joelpittet--relativeflag on that patchComment #4
joelpittetComment #6
djdevinThanks!
This appears to be called from quiz_questions_form_submit() when making sure there are enough taxonomy terms for the requested number of questions and also in _quiz_get_random_questions() when getting the random questions.
It's a little odd that we haven't seen fatal for this so let me check if this is actually getting called.
Comment #7
da_cloud commentedAs far as I can tell that function isn't used anymore. Both the on the manage questions page and when trying to start a quiz you'll get an error message that's triggered by the _quiz_build_categorized_question_list($quiz) function.
A full search on the _quiz_get_random_taxonomy_question_ids() function will result in 2 places where the function is being called.
1) Inside the function _quiz_get_random_questions($quiz)
This one only gets called when the quiz itself has a tid.
2) Inside the function quiz_questions_form_submit($form, &$form_state)
This only gets called when $term_id is not empty. and $term_id is set with the following code
Following the form field random_term_id we'll find the following code
In both cases the code will only be called if $quiz->tid will not result empty. So naturally we'll take a look in the hook_schema what the field does and it seems to be a deprecated piece of code that has long been replaced with a better structure.
Comment #8
da_cloud commentedMade a "quick" patch to see which code would be affected should we remove the old structure. Which as far as I can see, seems to be there to support older quizzes after upgrading to a newer version.
Comment #9
djdevinThanks, this looks great. The single term ID is very, very old and just hasn't been removed. In Quiz 4+ you could already have multiple taxonomy terms per quiz so that tid option must be from Quiz 3 or earlier.
I confirmed that there are tests in testCategorizedRandomQuestions for the current behavior.
Comment #10
djdevinI'll leave it RTBC for a bit, but it looks fine to commit.
Comment #11
joelpittetReady to commit yet?
Comment #13
djdevinYes. Fixed!