Randomization depending on user group

Randomization depending on user group

by Pedro Bibiloni -
Number of replies: 4
I would like to show the same questions to all students of the same working group, which might be possible with TWIG and set_seed.

In particular, students can be assigned to Moodle Groups, and these to Moodle Groupings. I wonder whether it is possible to access the group of each student (within the corresponding Moodle Grouping, which can be configured in a per-quizz base) as a TWIG variable. This way, I could be able to use something like:

{{- set_random_seed(STUDENT.group.id) -}}

Is this per-group randomization possible using other approaches? Could the group information be made available as TWIG variable? (I haven't found it, sorry if it already is!)

Thanks,
Pedro.
In reply to Pedro Bibiloni

Re: Randomization depending on user group

by Richard Lobb -
The capability isn't there at present, but I could perhaps add something. Normally, though, a student isn't in a single group - they can be in lots of groups. Can you clarify what you mean by "within the corresponding Moodle Grouping, which can be configured in a per-quizz base". This sounds like a feature I don't know about.

Also, questions don't necessarily run only within quizzes; they can also, for example, be run via the Open University embedded question filter. So any student attribute that depends on a quiz setting becomes problematic.
In reply to Richard Lobb

Re: Randomization depending on user group

by Pedro Bibiloni -
Thanks for the answer!

To solve the ambiguity of one student being in several groups, a Grouping (essentially a group of groups) indicates which are the groups that have to be taken into account with respect to a specific task. For instance, I might distribute students among "Working Group 1", ..., "Working Group n" and also among "Lectures on Wednesday", "Lectures on Friday". The former are within the grouping "Working groups", and the latter in the grouping "Class", so that any task (e.g. an assignment) can be configured as a per-working group basis or as a per-class basis.

This feature is documented here: https://docs.moodle.org/311/en/Groupings#Selecting_a_grouping_for_an_activity

I understand the concern regarding uses outside any Moodle tasks, which might lead to ambiguity. I haven't used the embedded question filter, so I am not sure whether it is configurable as any other Moodle task (which should let you specify a grouping). Also, ambiguity might appear due to misconfiguration of a grouping (usually each student belongs to one and only one group of the grouping, and students without a valid group are assigned to a default group... although this is not enforced by Moodle).

I can't think of a better way to address these empty/ambiguity issues than just setting default values... which could possibly lead to silent errors not being detected.
In reply to Pedro Bibiloni

Re: Randomization depending on user group

by Richard Lobb -
Thanks for clarifying, Pedro. However, CodeRunner has to operate using the question-type API that Moodle provides. Even if a question is running as part of a quiz, I have no way to find out what the quiz is, nor any of its settings related to groups and groupings.

So, sorry, but I think this is a "no-can-do".
In reply to Richard Lobb

Re: Randomization depending on user group

by Pedro Bibiloni -
Thank you in any case the answer, and thank you also for making and sharing CodeRunner! :)
Pedro.