How to limit the number of questions to be attended by students in a quiz if we give a choice

How to limit the number of questions to be attended by students in a quiz if we give a choice

av Jabez Samson -
Galle vástádusa: 22

We have posted 7 questions in using a quiz module (type: essay) out of which students should attend only 5. So is there a way when a student has attended any 5 questions, the other 2 should be restricted. Please help us! Thanks! @TimHunt

Gjennomsnittlig vurdering: -
Vástádussan geasa: Jabez Samson

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers
No, there isn't.

How did you handle this in paper exams? Did you have answer books that automatically locked themselves after students had written answers to 5 questions? (I bet they had those at Hogwarts!) Or, what if the students just makes some notes in the answer box on Q6, but then decides they don't really want to answer that one, they want to write a proper answer to Q6?

We did have a bit of a think about this at the OU. We worried that when students got to the summary page at the end of the quiz, they would see the table saying that 2 of the 7 questions were 'Not yet answered', and worry that they needed to go back and do them. We wanted a way to be able to repeat the instructions like "You should answer 5 questions out of 7" at the top of that page.  For now we did that with a quick and dirty renderer hack. We were wondering if it would be useful to have that option in standard Moodle?
Vástádussan geasa: Tim Hunt

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av John Provasnik -
Bilde av Particularly helpful Moodlers Bilde av Testers
I think it could be a useful option. In brick and mortar, when it came to the essay portion in some of my exams, my directions to my 7th graders were to complete 2 out of the 3 essays. They did their work on scratch paper and then put their final answers on the test paper, and left one blank. To achieve that now, I ask them to type 'skip' in the online text box and I assign them full credit for those. I dont' think this is necessarily a 'sound' practice in general but my middle school students were motivated by this.
Vástádussan geasa: John Provasnik

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av John Provasnik -
Bilde av Particularly helpful Moodlers Bilde av Testers
Though the most Moodle-y way to achieve this now is to probably just put the three essays into different assignment modules and all into one gradebook category - then have that gradebook category drop the lowest score of the three.
Vástádussan geasa: John Provasnik

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers

I did something using only javascript. Note that the teacher must clear his sessionStorage before marking.

Next time, I will try to use PHP too, which will probably make it better.

 

 

XML file attached:

Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Hi Dominique,
I found your approach above very useful, Many thanks for it.
Please you can help describe or instruction on how you apply this solution to a quiz plugin or multiple quizzes. Because if I have many quizzes, Do I need to edit the XML one by one? I will appreciate your kind response.
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

I improved the code. It could be further improved to facilitate the necessary modifications to allow different numbers of selected topics / available topics.

Anyway, all you need to do is insert the code into the question text HTML code of the multiple choice question with which students can select their essay topics. I put comments in the code to make the changes simple.

Someday I'll make it a plugin, but for now the javascript workaround should work fine.

https://moodleformulas.org/course/view.php?id=80&section=1 ↗

Formulas_20200819_0247.png?time=1597819996059
Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -

Hi Dominique,

Thank you for a great job, your Javascript workaround will exactly solve my present problem. If I may ask, is there a need for creating 4 essay questions apart from the initial multiple-choice question that has the selections option and will the essay manual grading be the same? Or if you can share the .mbz file of the course it will be clearer for me on the implementation of your code.

Many thanks once again.

Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
***Update***
Hi Dominique, 
I have implemented it the way you describe but the "Display essays" button is the only thing that is not Displaying. It will be a great help if you can help share the .mbz file of the course for me restored it into my server.

Many Thanks.

Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
***Update***
Hi Dominique,
Many thanks for the solution. I realize that the Question Behavior under the quiz setting has to be set at "Adaptive mode" for the button to display. It's now working as per your implementation. Thank you.
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
@ Dominique
But I will appreciate if you can share the .mbz file for the course.
Many Thanks.
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

The javascript workaround method is now fully automated and fairly easy to use. I also added more explanations including the quiz settings, etc. (At this time, I do not distribute the .mbz files.)

https://moodleformulas.org/course/view.php?id=80&section=1 ↗
Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Hi Dominique,
You made it much easier than it was before. Thank you.
Please is there suppose to be different in MOODLE version? I'm using 3.8.2 and I have implemented it exactly the way you describe but when I select the topics it always returns wrong topics instead of the selected ones. e.g: when I select topic 1,2,3 it returns Topic 2,3,4 and 5. Please could you help me clarify?
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

I just tried it on Moodle 3.9 and it works fine. I think it should work on 3.8.2.

Check:
  • how many choices there are in the multiple choice question (it must equal the number of topics available ),
  • the values of n (number of topics to select) and m (number of available topics),
  • the number of essay questions in the quiz (it must be equal to the number of topics).

Also make sure that when you preview a quiz, always click on "Start a new preview", but here, as the navigation block is hidden, you must first click on "Finish attempt...", then on "Start a new preview".

Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Hi Dominique,

All of the parameters are correct. I import your MCQ question directly into a new quiz and create the five essay questions but still, it's not returning correct values when I choose number of topics. please Any more suggestions on why it's not working?
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Update
Hi Dominique,
Thank you for all your support. I have upgraded my MOODLE version to 3.9. However, I realize the problem is caused by my present theme installed (academi). When I change the theme the scripts run as expected but when I enable it, it returns wrong topics. Any suggestion on how to pix that?

Many thanks.
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

I just tried with the Academi theme and it works great. The "choose essay topics" script is pretty straightforward, it should work fine on most platforms.

I put the course MBZ file on https://moodleformulas.org/course/view.php?id=80&section=1 ↗. Please keep me posted.

Formulas_20200820_1125.png
Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Thank you @Dominique for your continuous support,
I have just made a fresh MOODLE installation on my server and tried the "choose essay topics" scripts, it worked perfectly. But Once I installed "academi" theme on it the scripts stop working and returning wrong essay number on button click. Can you help share with me the version of academi you installed and got it to work?
I used V3.9 stable.

Many thanks
Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

I ran the script on a Moodle 3.7 install with Boost and Academi themes and on a Moodle 3.9 install with Boost theme. I used the latest release of Academi, i.e. v3.9 for Moodle 3.9, currently available on the Moodle plugins site.

Again, the script is very simple and therefore should work regardless of the theme. I don't know what is causing the problem. Have you tried clearing the Moodle caches? (Site administration / Development / Purge caches). Have you tried clearing the browser cache?
Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

In fact, I think I know where the problem is coming from.

There are different ways to load a script, which changes when it fires versus when the page loads, and therefore can affect how it works. These different ways may be interpreted differently from browser to browser, which makes using client-side javascript a bit tricky. It would probably be better if the script was on the server side for better control and proper functioning.

Thinking I was doing the right thing, I used the rigorous JavaScript "window.onload" event. Maybe the jQuery $(window).on("load",handler) is better. So I modified the script, which you will find attached. Please keep me posted on whether it works for you.

Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -

Hi Dominique,

Thank you for your continuous support.

I use the JQuery version of the script but it is given the same problem. I observed that on button click the scripts execute and display the right topics within a second, but once the page loads it will return invalid topics. Can it be there is an existing script that loads on the academi themes that is overriding the JQuery and Javascripts?


 

Vástádussan geasa: Buhari Alhassan

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Dominique Bauer -
Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hello Buhari,

It is a bit difficult for me as I cannot reproduce the problem you are having. Anyway, I added a 2 second delay before the display of essays (XML file attached). Could you tell me if that fixes the problem.

Vástádussan geasa: Dominique Bauer

Re: How to limit the number of questions to be attended by students in a quiz if we give a choice

av Buhari Alhassan -
Hi Dominique,
Thank you once again for a great job.
I have tried it, the delay is working but still, I couldn't get it to work effectively. It's returning the wrong topics still. I hope I can get more suggestion.
Many thanks