All or nothing

All or nothing

by Ernie Pao -
Number of replies: 13

Does anyone know if there is an all or nothing multiple choice type question plugin for Moodle 2.3?


Thanks,

Ernie

Average of ratings: -
In reply to Ernie Pao

Re: All or nothing

by Jean-Michel Védrine -

Hello Ernie,

I should have a version I did for 2.2 and modified for 2.3 somewhere. It is unfortunately largely untested. I will try to find it.

In reply to Ernie Pao

Re: All or nothing

by Itamar Tzadok -

I've created and uploaded to git earlier today such a question type (moodle-qtype_mcsaon; also attached here and will be uploade to the plugins repo later tonight). mcsaon stands for multiple choice some all or nothing.

This is a minimal (as possible) extension of the standard multichoice. This means that except for import/export it should do everything the standard multichoice does, plus all or nothing. For import/export it currently supports Moodle XML.

It works on 2.3 and would probably work also on 2.2 and 2.1.

The all or nothing is an additional option in the 'single' setting of the question. So the options for the 'One or multiple answers' setting in the question editing are:

  • One answer only
  • Multiple answers allowed
  • Multiple answer, all or nothing

In the all or nothing mode you need to assign correct option any positive (> 0) grade (at least one has to be 100% to pass a certain validation). Incorrect options can have empty grade (it is ignored anyway).

For import/export, the all or nothing mode is marked as 'aon' for the single attribute (this attribute is 'true' for one answer only and 'false' for multiple answers allowed.

That's it. Give it a try. Hope it works for you. Feedback appreciated. smile

In reply to Itamar Tzadok

Re: All or nothing

by Ernie Pao -

Thanks for the help, fellas!  Much appreciated.  I'll get my techies on it...hopefully it works!  I'll let you know.


Cheers!

Ernie

In reply to Ernie Pao

Re: All or nothing

by Jean-Michel Védrine -

IMHO never too much question types big grin so additionnaly to Itamar's work, you can find a version of Adriane Boyd's all or nothing (alias multichoiceset) question type upgraded for Moodle 2.3 here :

https://github.com/jmvedrine/moodle-qtype_multichoiceset

In reply to Jean-Michel Védrine

Re: All or nothing

by Ernie Pao -

Thanks Jean-Michel!  This must be a new version...I could only find a 1.9 and 2.0 version before.

In reply to Ernie Pao

Re: All or nothing

by Jean-Michel Védrine -

Hello Ernie,

Yes, as I said this is a version I did.

First I took the latest version done by Adriane Boyd, then I upgraded it to Moodle 2.2.

Recently when I upgraded to Moodle 2.3 I did the few changes needed so that it run without errors.

But there is a part of the code that I never tested : the part that upgrade attempts from Moodle 1.9 or 2.0 to the new question engine in Moodle 2.1/2.2/2.3. So if you need this plugin to upgrade your website from Moodle 1.9 or 2.0, I suggest you don't use it directly on your production website, firt try on a copy to see if it works.

Note also that I just pushed some bugfixes to the 1.9/2.0 -> 2.1/2.2/2.3 migration code just a few minutes ago.

If I manage to find some time, i will add phpunit tests to this question type to verify that all is working as expected.

In reply to Itamar Tzadok

Re: All or nothing

by Ernie Pao -

Hi Itamar,


Your plugin seems to work just fine...thanks!

I'm having some trouble though figuring out how to import my questions into my database using XML format.  I manually created a question in Moodle, then exported it in XML format.  I tried to follow the coding for the rest of my questions but it wouldn't import back into the database.  Any ideas?


Thanks in advance,

Ernie

In reply to Ernie Pao

Re: All or nothing

by Itamar Tzadok -

Here is a simple example of the xml. Note the aon in the 'single' attribute, and fraction="100" for correct answers. Except for the 'aon' the xml is exactly the same as for the standard multichoice.

I'll try to add also the GIFT import/export format. smile

  <question type="mcsaon">
    <name><text>mcsaon - aon</text></name>
    <questiontext format="html"><text><![CDATA[<p>It's all or nothing!</p>]]></text></questiontext>
    <defaultgrade>1.0000000</defaultgrade>
    <single>aon</single>
    <shuffleanswers>true</shuffleanswers>
    <answernumbering>abc</answernumbering>
    <answer fraction="100" format="html">
      <text><![CDATA[<p>Correct</p>]]></text>
      <feedback format="html"><text></text></feedback>
    </answer>
    <answer fraction="0" format="html">
      <text><![CDATA[<p>Incorrect</p>]]></text>
      <feedback format="html"><text></text></feedback>
    </answer>
  </question>

In reply to Itamar Tzadok

Re: All or nothing

by Ernie Pao -

This looks like what I tried yesterday but it didn't seem to work.  I tried saving (in UTF-8 encoding) with notepad as well as in Dreamweaver but it didn't seem to work when I uploaded.  I kept getting the message "The type of the file you selected (text/plain) does not match the type expected by this import format (application/xml)".  Any ideas?

If you come up with a GIFT import/export format, please let me know!  It's much easier to use for a rookie like me!

Cheers!

Ernie

In reply to Ernie Pao

Re: All or nothing

by Itamar Tzadok -

The import file name has to be something like

filename.xml

Note the extension 'xml'. In previous Moodle versions it could work with txt extension as in filename.txt. But not anymore. It's Moodle core.

You can write the file as txt and then change the extension to xml.

hth smile

In reply to Itamar Tzadok

Re: All or nothing

by Ernie Pao -

Thanks Itamar!  Looks like I figured out what the problem was.  I was missing the "quiz" tags in my xml file.  Thanks again for all your help!  You're a saviour!


Ernie

In reply to Itamar Tzadok

Re: All or nothing

by martin quarrington -

I loaded your patch (itamart-moodle-qtype_mcsaon-3b087fe.zip) and now I have an error shown below. Can you tell me how to get past this?


Calculated Simple

Calculated Multichoice

both show this error.


qtype_calculated (2015111000)  fails unavailable



Attachment Error1.jpg
In reply to martin quarrington

Re: All or nothing

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

The error being shown shows that both Calculated Simple and Calculated Multichoice require Calculated to be installed and the last line of Plugins requiring attention is telling you that Calculated is missing so it needs to be installed.

Once you install Calculated, that will automatically fix the other two problems.