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.

CommentFileSizeAuthor
quiz-update-random-switch.patch1.18 KBklausi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

falcon’s picture

Category: bug » task
anthonyR’s picture

Patch fixes the bug, thanks.

klausi’s picture

Cool, could you set this to RTBC if you think it is ready?

anthonyR’s picture

Status: Needs review » Reviewed & tested by the community
steinmb’s picture

Issue summary: View changes

Bumping the issue. It is outdated though but without checking. Anything in there that could be applied to 7.x-5.x?

djdevin’s picture

_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.

steinmb’s picture

Thanks 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?

djdevin’s picture

I 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.

steinmb’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Ah, 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()