Multiple choice question : specific points distribution

Multiple choice question : specific points distribution

by Ziliev Bamoss -
Number of replies: 8

Hey everybody ! First of all a little though to all of you, hoping that everything is going well in these hard times !!
(Already asked this on the French moodle but it seems like no one has any answer at all (and I already apologize for my bad englando))

My issue :

Currently, as you may know, MCQs are made by adding the % points given to each item.
For example if I have 3 correct answers with each of them graded with 33% question's value, ticking 2 of 3 would result in getting 66% of the total question value (which is basically 0,66 point out of 1 in most case)

The problem is that my university has some sort of... weird & random grading system. Actually this is beacause the initial logic is opposed to moodle's one : the student gets started with 1 point and then loses 50% of the mark for each error (rather than starting from 0 and earning points with correct answers)

If the student has the right combination of answers : 1 point
If the student has a fault in the patern : 0,5 points
If the student has 2 or more faults : 0 points
(And yet, the TRUE university's system has en intermediate stage which makes that "2 faults = 0.2 point" then "3faults or more = 0 point" but we will limit ourselves to my example because that would be nice already to have this)

Searching in both French & English forums I did find the possibility of making a "patern-like" answer which seems to lead to a "all-or-none law" : the student is left with 0 point if he has a single (or more)  wrong answer.
This doesn't fit our standards because we would like an extra step in which you get 50% out of the total point if you only have 1 wrong answer.  Thing that I didn't manage to find anywhere ☹️

I specify that in our model, is counted "incorrect" a "false" item which has been ticked by the student BUT also is counted "incorrect" a "true" item which has not been ticked (which is slightly different from assuming that the only "incorrect" thing is when you tick a "false" item you'll agree to that)

Here we are, you can't reproduce this model faithfully using the inital %-like moodle system. I think i did widely look on the various forums seeking for a solution suited to my case but I already apologize if i missed an obvious one !

Hoping i've made this clear, I will explain as much time as needed to be understood with my approximative english.
Thanks a lot to those who read this and have a nice day !

Ziliev



Average of ratings: -
In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I agree that you cannot do this in standard Moodle.

Well, in the particular case where the question has two correct choices, you can do this by making the two correct choices 50% each, and all the wrong choices -50%, but that won't work in general.

You could get exactly the grading you want (including the 0.2 thing) by creating a new question type plugin. As you said, there are some examples out there like https://moodle.org/plugins/qtype_multichoiceset and https://moodle.org/plugins/qtype_oumultiresponse. You could make another one like that. It is really just a matter of changing one function https://github.com/ecampbell/moodle-qtype_multichoiceset/blob/master/question.php#L47 - but then you need all the other code around it to make a functioning question type.

(Et votre Anglais est mieux de ma Française smile)
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Multiple choice question : specific points distribution

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

Hi Tim,

Please forward my best wishes to your French girl ("ma Française").wink heart

Joseph

Average of ratings: Useful (1)
In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

by Ziliev Bamoss -
Hey ! Thanks for that really quick feedback (both of you lol)

Yup indeed I was thinking about thoses to type of question in my message.

Hum I feel kinda unconfortable in touching the code actually. My code level is not academic, I always learned by myself and here we are : I understand a code when reading it, I do understand the changes that are needed there for my situation but to be honest I am unsure of HOW this is supposed to be written ☹️

Do you have any idea about the final code ? If yes can you show me the way s'il-vous-plait ? That would be really awesome !
(If so, do not consider the crappy "0,2 point" option as the university is planning to not do these anymore because it leads to several issues for nearly none benefits)

Best regards and merci beaucoup 😉

Ziliev

In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

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

Hello Ziliev,

As Tim said, "You could make another one [a new question type plugin] like that. It is really just a matter of changing one function https://github.com/ecampbell/moodle-qtype_multichoiceset/blob/master/question.php#L47 - but then you need all the other code around it to make a functioning question type."

Indeed, the right approach is to create a new question type plugin.

A poor man's and temporary solution would be to simply modify the All-or-Nothing Multiple Choice question type. Proceed as follows:

  • Install the All-or-Nothing Multiple Choice question type plugin.
  • Make a backup copy of the file ...htdocs/moodle/question/type/multichoiceset/question.php, for example question_backup.php.
  • Edit the file question.php and replace:
   if ($numwrong == 0 && $numcorrect == $numright) {
       $fraction = 1;
   }
      

with

   if ($numwrong + ($numcorrect - $numright) == 0) {
       $fraction = 1;
   }
   if ($numwrong + ($numcorrect - $numright) == 1) {
       $fraction = 0.5;
   }
   if ($numwrong + ($numcorrect - $numright) == 2) {
       $fraction = 0.2;
   }
   if ($numwrong + ($numcorrect - $numright) >= 3) {
       $fraction = 0;
   }    
      

And there you go! Et voilà!

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

Re: Multiple choice question : specific points distribution

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

Thanks Dominique. Probably also a good idea to edit some of the language strings in question/type/multichoiceset/lang/en/qtype_multichoiceset.php, so users know what to expect.

To actually make a new question type, then you need to do those steps, but but then also:

  1. Rename multichoiceset to a new name everywhere! (in the code, and filenames).
  2. Update even more language strings, and the readme files, comments in code etc.
  3. Run all the automated tests, and change the tests, if necessary, so they pass.
  4. Test manually. There are some hints on that at https://docs.moodle.org/dev/Question_types#Manually_testing_a_question_type.
And, to make the plugin more generally useful, then rather than hard-coding the 1, 0.5, 0.2, 0 logic, I would actually add a setting to Edit question form where you could specify a list of numbers to customise the grading scheme. Question type could be called 'Multiple response graded by number of error' - or someone could try to think of a snappier name!

Average of ratings: Useful (4)
In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

by Ziliev Bamoss -
Wow you guys are amazing, thoses changes seems to be exactly what I was aiming for !

Though now I have a new problem : I can't install the plugin
You know I tried the 3 ways : getting the plugin by searching it in moodle library, downloading the .zip then uploading it in the "Plugin" administration section or either uploading it right in the FTP explorer.
Every time the upload works fine. Yet I'm still getting that "500:internal server error" if I ever try to synchronize the files ...
I am unsure of what kind of problem it is since it is the really first time i see this although it is not the first plugin I am installing :/

Thanks again !


UPDATE : I am not sure of this but it looks like "  $CFG->directorypermissions "" is involved as the default setting is on " 0777 ". Internet shows that it is quite a common issue uh

Oh and i am running moodle 3.7.1+
In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

by Ziliev Bamoss -
UDAPTE 2 : Yup indeed it was the " $CFG->directorypermissions " who was involved ! But it is fixed now thanks to https://tracker.moodle.org/browse/MDL-53899 (thanks a lot to the contributors !)
Now I'm on my way to set-up this new question type, I'll give you a feedback soon :D

PS : I had to reply to my own message since you can "modify" your own message only once for some reasons :v
In reply to Ziliev Bamoss

Re: Multiple choice question : specific points distribution

by Ziliev Bamoss -
Hey ! Final udapte !

Everything is working perfectly fine (for the moment atleast uh), my students will have for now a decent gradutation matching the university's standards
Thanks a LOT to you Tim and Dominique (and Joseph too lol) for your help, really appreciated !

Again take care of you all and best regards <3

Ziliev

PS : my problem is solved but I don't know if there is something to do with the topic as locking it or put an annotation to show it idk
And thanks again :D
Average of ratings: Useful (2)