How to choose random question by Tag 1 OR Tag2 ?

How to choose random question by Tag 1 OR Tag2 ?

by Majid Rafiee -
Number of replies: 6

Hi,

I have a few questions in my question bank. My questions were tags by at least two tagged each. for instant, I have 5 questions which were tagged as: 

Tag 1:  TAG A

Tag 2: TAG B

Another set of questions containing 6 questions were tagged as:

Tag 1: TAG A

Tag 2: TAG C

And the thirds set including 7 questions were tagged as :

Tag 1: TAG A

Tag 2: TAG D

In my exam, I want to have one random question from either (TAG C) or (TAG B). and in the next section one random question from either  (TAG B) or (TAG D). 

The problem is that when I choose a random question  (TAG C) and (TAG B), moodle looks for questions that have both TAG C and TAG B. Hence, it returns there is no question with the mentioned tags. How an I use tags in OR format rather than in AND format ?

Thanks

Average of ratings: -
In reply to Majid Rafiee

Re: How to choose random question by Tag 1 OR Tag2 ?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

"How an I use tags in OR format rather than in AND format ?"

Simple answer is you can't. See this post: https://moodle.org/mod/forum/discuss.php?d=411528#p1663598

Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: How to choose random question by Tag 1 OR Tag2 ?

by Andy Swineford -

I'm having this issue, too. I just spent many hours developing a quiz that chooses random questions based on tags, only to find out it couldn't find any questions because it was using AND logic rather than OR logic, which I did not expect. How do we change you can't to you can?

In reply to Majid Rafiee

Re: How to choose random question by Tag 1 OR Tag2 ?

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
In addition to what Joseph has said, you might consider making a quiz category and then putting these TAG B and TAG C questions into this category. This is one way to do an OR condition.
Average of ratings: Useful (2)
In reply to Rick Jerz

Re: How to choose random question by Tag 1 OR Tag2 ?

by Majid Rafiee -
I did. I made categories (Chapter 1, Chapter 2,..). However, I want to do it for question which are all in the same category.
In reply to Majid Rafiee

Re: How to choose random question by Tag 1 OR Tag2 ?

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
You now have me a little confused. However, I think that as you continue to work with Question Categories and Tags, you will continue learning what one can or cannot do. It appears to me that you can make Chapter categories, and then if you wish, Tag some of the questions as you are doing to achieve your OR needs. However, as Joseph pointed out, some situations are not doable.

Remember in Moodle you can have multiple subcategories, and that you can pick from a major head with multiple categories below it.
Average of ratings: Useful (1)
In reply to Rick Jerz

Re: How to choose random question by Tag 1 OR Tag2 ?

by Majid Rafiee -
Thank you for your suggestion. I haven't noticed about subcategories. I can handle my issue with using subcategories. Thanks a lot for your help.
However, I think OR condition is a must in tag system of moodle. Thank you