Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the settings for a quiz are changed to "Random questions" all previously assigned questions are not converted to random questions, they remain "always" questions. The only workaround is to remove all questions from the quiz and add them again, then they are in random mode.
If a quiz is switched back to "No randomization" then all assigned questions are just deleted, which is imo just wrong. Attached is a patch that updates the question type if the random mode of the quiz is changed.
Comment | File | Size | Author |
---|---|---|---|
quiz-update-random-switch.patch | 1.18 KB | klausi | |
Comments
Comment #1
falcon CreditAttribution: falcon commentedComment #2
anthonyR CreditAttribution: anthonyR commentedPatch fixes the bug, thanks.
Comment #3
klausiCool, could you set this to RTBC if you think it is ready?
Comment #4
anthonyR CreditAttribution: anthonyR commentedComment #5
steinmb CreditAttribution: steinmb as a volunteer commentedBumping the issue. It is outdated though but without checking. Anything in there that could be applied to 7.x-5.x?
Comment #6
djdevin_quiz_check_num_random() converts them back to "always" questions when a quiz goes from random to non-random
In 5.x _quiz_check_num_always() only deletes questions if the quiz is going to categorized random questions (where there are no questions in the quiz, just terms).
So this might already be implemented in 5.x, but it could use some tests.
Comment #7
steinmb CreditAttribution: steinmb as a volunteer commentedThanks for the swift reply. I see some movement on the 7.x-4.x branch but I guess you want everyone that can to upgrade to 7.x-5.x, though given the API changes, I am guessing that any custom code would break for sites having them if them move. If my guesswork is right, would it make sense and add this to 7.x-4.x and perhaps cutting a stable release. Anything blocking such a release there?
Comment #8
djdevinI haven't touched 4.x in years and don't plan to unless it's something severely critical.
There are zero automated tests, it has never been covered by security, it doesn't use Drupal APIs for much of the functionality, so who knows what will break if we introduce changes. I would not feel comfortable releasing it as "stable" for those reasons.
5.0 has been the recommended release for 2 years now and I think it's best to encourage upgrading to stable. Even with heavily customized 4.x installs (I've seen plenty) there is still a solid upgrade path even from 6.x-4.x.
Comment #9
steinmb CreditAttribution: steinmb as a volunteer commentedAh, those are from @paalj (H5P maintainer). Thank your for taking the time to summarize the state of the branches. That helped a lot :) Closing this as outdated and created #2994257: Write test for _quiz_check_num_random()