Conditional branching quiz

Re: Conditional branching quiz

by Craig Mackey -
Number of replies: 17

I am still interested in a solution, but have not been spending much time on it, given that I am not a programmer and Moodle does not seem to want to include this facility. It is a shame because for remediation purposes it would be ideal.


Craig.

In reply to Craig Mackey

Re: Conditional branching quiz

by Paul K -

Hi,

it will be great to have such a funtionality in the core Moodle quiz. Actually there is no option to realize such branching scenarios using current functions available in the quiz activity. UNfortunately this is a reason why we are currently looking for another e-learning system with this option.

In reply to Paul K

Re: Conditional branching quiz

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

The lesson includes several question types and is designed for this.  What do you need that is not in there?

In reply to Emma Richardson

Re: Conditional branching quiz

by Paul K -

I would like to follow up this discussion, as we haven't found any solution or better platform which will have the conditional branching scenario together with other types of quizess which we are using. Thus our goal is to develop the conditional branching scenario based on the moodle quiz-activity.

My question is more directed to the developers, but I would like to leave it in this thread. I'm looking for a function in the quiz activity which will check the number of corrected answers for a group of questions during the quiz i.e. after 10 first questions before going into the next page. Based on the documentation the file processattempt.php is responsible for handling the responses from students and for closing an attempt. This file uses functions from the file attemplib.php among others a function named get_sum_marks() which returs sum of grades. However this function is used only if the function is_finished() returns positive value, which means when the quiz has been finished.

My question is  whether it is possible to use any build in quiz function to read the partial grades from already answered questions during the quiz, when the quiz status is IN_PROGRESS.



In reply to Paul K

Re: Conditional branching quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, at the moment, the quiz selects all the questions for the quiz attempt, and initialises them, when the attempt is started. (See the code in startattempt.php, and the functions it calls.)

That is not the only way it could have been implemented (although there are advantages as well as down-sides).

But it does mean that doing what you want as a modification of the quiz would not be easy.

However, it is possible to replace one question with another after the attempt has started. See process_redo_question in attemptlib.php, the key line is $this->quba->add_question_in_place_of_other.

The alternative would be to create a completely new activity module that uses questions (see https://docs.moodle.org/dev/Using_the_question_engine_from_module). That would also be a lot of work.

Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Conditional branching quiz

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
In reply to Marcus Green

Re: Conditional branching quiz

by Paul K -

Dear Tim, Dear Marcus,

thank you for your valuable hints. I will invest some time to figure out which option is the best for us and then will let you know.

Best regards

Pawel

In reply to Paul K

Re: Conditional branching quiz

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Emma's suggestion of using the standard Lesson activity along with the contributed Embed questions filter might also be worth exploring. (Those are two links)

In reply to Mary Cooch

Re: Conditional branching quiz

by Paul K -

Dear Mary,

it took some time to check the Lesson activity together with the Embed questions filter. It is really a powerful plugin which enables to realize different teaching and exam szenarios. Unfortunately in my case, at least based on my expierence with the Embed question filter, it is not possible to implement the conditions which will control the number of achieved points. Such functionality is important to decide whether the student should move forward to the next  level with another questions or whether the lessons should be finished.

My exam szenario should look this:

Exam Part I - Beginners level (15 questions).

Exam Part II - Intermediate level (15 questions).

Exam Part III -  Master level (15 questions).

If Achieved_Points more than 50% then go to Part II  ELSE (Finish)

If Achieved_Points more than 50% then go to Part III ELSE (Finish)


I don't think that this scenario can be realised with the lesson activity and the embed question filter.



In reply to Paul K

Re: Conditional branching quiz

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Prepare three distinct quizzes: 

  • Quiz I - Beginners level (15 questions)
  • Quiz II - Intermediates level (15 questions)
  • Quiz III - Master level (15 questions)

In the quiz settings of Quiz II and Quiz III, set the access restrictions (under Restrict access) according to your scenario.

Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Conditional branching quiz

by Paul K -

Dear Dominique,

it will be too complicated for freshly backed students which will work with Moodle for the first time.  It must work within one single activity. As simple as possible.

Nevertheless thank you for your hint.

Pawel

In reply to Paul K

Re: Conditional branching quiz

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I disagree, you can make it easy.  Use the feedback feature in the first quiz to link to the second quiz once they achieve the desired score...and the same for quiz two...

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Conditional branching quiz

by Paul K -

Dear Tim,

I'm making a litte progress in developing the branching scenario within the quiz activity. The code structure is not intuitive, however the functions and classes are very well documented and described, which helps me a lot. Nevertheless I'm  looking currently for a way to count only the graded questions which are placed on a certain quiz page. I have found somewhere your post which partially explains it, hovewer it desribes the way how to check the status for all the questions within a quiz activity. Is there any way to do this only for selected questions stored on a certain quiz page?

foreach ($this->quba->get_attempt_iterator() as $qa)
             {       
                 if (($this->currentpagenumber == $thispage) && ($qa->get_state()->is_graded())) {
                $this->answered += 1;          
             }    


In reply to Paul K

Re: Conditional branching quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Try changing that code to something like

             foreach ($this->get_slots($pagenumber) as $slot) {        
                 if ($this->get_question_attempt($slot)->get_state()->is_graded())) {
                $this->answered += 1;           
              } }


Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Conditional branching quiz

by Paul K -

Hi Tim,

brilliant, it works as expected! Thank you for it! Know, I'm really close to achieve the branching scenario.

In reply to Paul K

Re: Conditional branching quiz

by Matthew Abbott -

Hi Paul!

Were you able to achieving the branching scenario you were going for? I am interested in implementing something similar for my classes.

Thanks!

In reply to Matthew Abbott

Re: Conditional branching quiz

by Craig Mackey -

Only by using the STACK question type, which has a fair learning curve.

In reply to Matthew Abbott

Re: Conditional branching quiz

by Paul K -

Hi Matthew,

almost. I still need to modify some core quiz functions to get it work as expected. I hope to finish this plugin until the beginning of the summer term. Will let you know.