Ordering -- New question type!

Ordering -- New question type!

by Thomas Robb -
Number of replies: 22
Hi everyone,

Here is something else that I hope Tim Hunt will include in his plans.

I have a need for a new question type which requests students to place items in their correct (normally, chronological) order, so have gone ahead and taken a stab at programming it. It is based on the Matching question type, but it has its own simpler GIFT import format and will keep the choices in the pulldown answer menu in order, whereas the matching type always randomizes them.

The GIFT format is simple:

::Life::Put the following events in their correct order {>birth, schooling, employment, retirement}

The greater than symbol after the initial curly bracket marks this as an ordering question. Naturally, there is no need to input the answers since they follow the order of the input items. There is no restriction on the number of items you can place in the series, although something above 10 might become a little tedious!

Right now, the items need to be in their absolute order in order to be considered "correct" since the order number associated with that item is compared to the "correct" answer. In a future version, I intend to fix the scoring scheme so that an answer will be counted as correct if it is higher in order than the previous one and lower in order than the following item.

This evaluation scheme will also allow a subset of the items to be selected for presentation. For example, you might take 20 events that occur in a story and then ask the student to put only a random 5 of those events into the correct order.

The attached zip file contains all of the required pieces to make it work in the current version of 7.0. It will most likely work with 6.0, as well, although I haven't tried it.

I'd be very happy if someone else would like to carry on with this, and implement the relative answer and random functions. Ideally, the item should be converted to a drag & drop activity rather than having pulldown menus.

If this question type would be useful for you, please vote with your mouse! MDL-7933.
Average of ratings: -
In reply to Thomas Robb

Re: Ordering -- New question type!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Thank you Thomas. It would be great if lots of people could try this out and add their comments to this thread.
In reply to Thomas Robb

Re: Ordering -- New question type!

by A. T. Wyatt -
I voted for it! I will see about installing and testing for you in the next week or so!

atw
In reply to A. T. Wyatt

Re: Ordering -- New question type!

by A. T. Wyatt -
I had a couple of problems; I was testing on moodle 1.7+, installed on my PC at home from the all-in-one windows installer from moodle.org. It worked fine, so long as I created the question and used it in an exam from the original quiz. But when I tried to move it, I ran into some trouble.

1) When exporting the ordering questions as xml, export seemed fine. But when importing into another quiz (in another course) I got an error.

2) When attempting a gift export, I got an error. So I never actually got the export to work.

3) The help file for "shuffle" gave me a missing file error--Help file "ordershuffle.html" could not be found! (But this might have nothing to do with the ordering question!)

4) I have a missing string when attempting to import.

Screenshots below--

atw
In reply to A. T. Wyatt

Re: Ordering -- New question type!

by A. T. Wyatt -
Here is the error message when attempting to import an xml file of ordered questions--
Attachment error_on_import.gif
In reply to A. T. Wyatt

Re: Ordering -- New question type!

by A. T. Wyatt -
Here is the error message I get when attempting to export ordered questions to gift format--
Attachment error_gift.gif
In reply to A. T. Wyatt

Re: Ordering -- New question type!

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

Unfortunately, when creating new question types in current versions of Moodle there is still the unsolved problem of export/import core files. Tim Hunt is well aware of this fact and is working on improving things in future versions of Moodle. See MDL-2727.

In the meantime, ...

  • Thomas has not provided an XML export/import format for his new "order" question type, only a GIFT format.
  • The error you are getting "No handler for qtype order for GIFT export" is due to the fact that, with GIFT format, all question types have to be "registered" by Moodle, which of course excludes new question types. Until a better solution is found I have tried and tested successfully the following hack.

In Thomas's \question\format\gift\format.php file, change ORDER to "order" everywhere:

line 221
$question->qtype = "order";
line 312
case "order":
line 637
case "order":

Hope that helps,

Joseph

In reply to Joseph Rézeau

Re: Ordering -- New question type!

by A. T. Wyatt -
Thank you, Joseph!

A couple more things I noticed (for the record):

Still using the Moodle 1.7+ PC version; did a backup and restore of the course with the ordering questions in the quiz pool.

During the restore process, I received a great many of these:
Could not recode question_order_sub 13
Could not recode question_order_sub 11
Could not recode question_order_sub 10
Could not recode question_order_sub 12

And then when I checked the restored course, although the questions were visible, none of the choices (subparts?) were there and I got
Error: Missing subquestions!

Error: Missing subquestions!

Error: Missing subquestions!

Error: Missing subquestions!

Error: Missing subquestions!

Error: Missing subquestions!
When I tried to preview the quiz.

So, I do not believe it is quite ready for wide use, but it is an excellent question type and I hope we will have more question types in the future. Thomas, thank you for your efforts!

atw
In reply to A. T. Wyatt

Re: Ordering -- New question type!

by Thomas Robb -
Thank you, A.T. Wyatt and J. Rézeau for your comments and efforts to use the module. Now that school is on vacation for me (we had classes until 12/26!) I can try to fix the problems that you have found. I'll try to get another version out soon, AFTER testing for all of the problems you have found!

Cheers,
Tom
In reply to Joseph Rézeau

Re: Ordering -- New question type!

by Thomas Robb -
Josesph says:
  • The error you are getting "No handler for qtype order for GIFT export" is due to the fact that, with GIFT format, all question types have to be "registered" by Moodle, which of course excludes new question types. Until a better solution is found I have tried and tested successfully the following hack.

In Thomas's \question\format\gift\format.php file, change ORDER to "order" everywhere:

line 221
$question->qtype = "order";
line 312
case "order":
line 637
case "order":

Actually, I had "registered" it, but I stand guilty of not including the modified file in the distribution. black eye It's moodle/lib/questionlib.php where the question types are defined. I've attached a copy with the file to this message. I'll work on the other problems very soon.
In reply to Thomas Robb

Re: Ordering -- New question type!

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

Hi Thomas,

First of all let me wish you pleasant Xmas holidays (you do deserve them).approve

In fact, the "registering" of question types in questionlib.php is not a very good idea, especially as it makes even more complicated the creation of new question types. The Moodle XML import/export format no longer relies on registered question types, and I would advise to do the same for the GIFT import/export format, i.e. simply using my proposed solution, which works fine and does not entail any modification of questionlib.php. I expect Tim would agree on this.

As for A.T. Wyatt's problems with backup/restore of a course including the new "order" question type, I expect it is due to your not having (yet) included that new question type in the XML import/export format.

All the best,

Joseph

In reply to Joseph Rézeau

Re: Ordering -- New question type!

by Thomas Robb -
Dear Joseph and all,

While I agree with you that it is probably not useful to create those declared variables in the questionlib.php file, I think that Tim Hunt has to deal with the problem in a uniform way. I don't think it would be good for some elements in a file to work one way and others, another way, so I have stuck to the declarations for the time being.

Attached is a new zipped file with both the XML import/export format AND the GIFT format now working. I've used the nightly version of 1.7 for all of these files, reinserting my changes. I have tested it and it seems to work properly.

I would appreciate whatever feedback you all can give me!
In reply to Thomas Robb

Re: Ordering -- New question type!

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

Thank you Thomas.

Your proposed ordering question type provides for a small improvement over the current matching type. I expect it makes authoring such questions easier for those teachers who create their questions using the GIFT format rather than the Moodle Question authoring interface, but I never use the GIFT format myself.

Some suggestions for further development of this question type.

> Ideally, the item should be converted to a drag & drop activity rather than having pulldown menus.

Oh yes (similar to the drag & drop Hot Pots matching activity). Actually, since all that counts is that the various elements be put back into their original order, we could do without the numbers themselves and only display the elements to be ordered on screen.

> I intend to fix the scoring scheme so that an answer will be counted as correct if it is higher in order than the previous one and lower in order than the following item.

I'm interested in this scoring scheme for an activity I often use in language teaching, i.e. the sentence jumbling exercise. Does the following example correctly describe what you have in mind? It is the scoring system I use for my jumbled words/sentences/paragraphs activities.

  • Correct answer: A B C D E F G H
  • Student's answer: A C D B E F G H
  • 1 Point given for the following sequences: H-A, C-D, E-F, F-G and G-H.
  • Max. points : 8
  • Total points for current answer: 5

Thanks again,

Joseph

In reply to Joseph Rézeau

Re: Ordering -- New question type!

by Thomas Robb -
This certainly would be another great use of the ordering quiz, and perhaps the same scoring scheme could be used.

I think there was a typo in your example:
  • 1 Point given for the following sequences: H-A, C-D, E-F, F-G and G-H.
This should have been A-C, C-D, E-F, F-G and G-H, Right? It this is the case, then there are only 4 pairs since A-C does not qualify.

For the grading of events that merely need to be in the correct sequence, it could work like this (assuming the correct order is A B C D E F G H). The basic rule is that an item is correct if the following item is later in the sequence.

Answer 1: A C D B E F G H -- 7 points, since only one item is out of order
Answer 2: A C D B F H G E -- 5 points. These items have an earlier item following them: D-B, H-G, G-E

The following one is problematic. It has every other one first in correct order, following by the remaining ones in correct order. My scheme above would award it 7 points since there is only one item (G) that has something earlier following it. Yet, if correct answers should be contiguous, it would be awarded 0 points.

Answer 3: A C E G B D F H --

Perhaps the rule must read like this: a) the following item must be the expected contiguous item. Special rules: the first item is correct if it is the expected first item, the last item is correct if it is the expected last item.

In this case, the evaluations of the three above answer sets would be as follows:

Answer 1: A C D B E F G H -- 6 points, A, C-d, E-f, F-g, G-h, H (one higher than Joseph's)
Answer 2: A C D B F H G E -- 2 points. A, C-d
Answer 3: A C E G B D F H -- 2 points. A, H

It could be that we will have to give the teacher a choice of grading schemes.

1) Absolute position in sequence required. (ABSOLUTE)
2) Item okay if positioned correctly relative to preceeding and following answers. (RELATIVE)
3) Item okay if following item is the correct contigious item. (CONTIGUOUS)

What other possibilities are there?



In reply to Thomas Robb

Re: Ordering -- New question type!

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

Thanks for your answer, Thomas.

Perhaps I should have made it more clear that in my re-ordering exercises I want to award points for correctly ordered "strings". These strings are either words, groups of words, sentences or (short) paragraphs. When I award 1 point to the "sequence" H-A it means that I award the point if the student places A in the very first position and H in the very last. I agree that this was not clear and I agree with your proposed system(s). But I do not want to award a point for the sequence A-C because those elements are not contiguous.

In other words, I am almost satisfied with this rule of yours:

the following item must be the expected contiguous item. Special rules: the first item is correct if it is the expected first item, the last item is correct if it is the expected last item.

which I would rephrase:

Special rules: One point is given if both the first item is the expected first item and the last item is the expected last item.

Which gives:

  • Answer 0: A B C D E F G H -- 8 points (max points)
  • Answer 1: A C D B E F G H -- 5 points, A...H, C-d, E-f, F-g, G-h
  • Answer 2: A C D B F H G E -- 1 point. C-d
  • Answer 3: A C E G B D F H -- 1 point. A...H
Joseph
In reply to Joseph Rézeau

Re: Ordering -- New question type!

by Thomas Robb -
Hello Joseph,

It isn't very obvious to me why getting a point for selecting the correct first element must be contingent on also selecting the correct last element. To me, it would make sense (for my own application of this, at least) to award two points for this.

Nevertheless, our difference of opinion is clearly indicative of the fact that others will have their own scheme for evaluating items. Somewhere in the system there will have to be a mechanism for people to tailor the rules to their own liking!

--Tom
In reply to Thomas Robb

Ordering -- Jan 1, 2007 version

by Thomas Robb -
A Happy New Year to everyone!

Here is my third version of the Ordering question type, with a number of improvements. I think that this has everything in it that I would want, with the exception of the ability to generate quizzes on a random subset of the items, say, any 5 of the 10 items in the full set. I'll continue to work on this.

The improvements in this version are:

1) A choice of three evaluation methods:

a) Exact answer: This requires an exact match to the specified ordering position. If, for example, the last item is inserted as the third item, all of the answers from that point on
will be one off and will not be evaluated as correct.

b) Relative answer: A response is considered correct if the previous item is earlier in the ordering.

c) Contiguous answer: A response is considered correct if the following answer is the next expected answer.

More types are logically possible and I will be happy to tailor make the code for any other evaluation schemes. There is a help file included, "evaltypes.html" which explains the answer types in more detail with illustrative examples.

2) I have removed the answer fields from the input screen since these are fully predictable by the ordering of the items on the screen. (The answer values are there as hidden items.)

I have tried the code out on two sites and it has worked bug-free for me. I look forward to your further input!

In reply to Thomas Robb

Re: Ordering -- Jan 1, 2007 version

by A. T. Wyatt -
This looks great! I have a question--what versions are you already testing and what versions do you want to test? I expect we have been working with 1.7, but do you also want to test on 1.6? Or do you want to go with 1.7 and above since that is the current release?

atw
In reply to A. T. Wyatt

Re: Ordering -- Jan 1, 2007 version

by Thomas Robb -
Since there are so many still using 1.6, it would be great if we could get the ordering qtype to work with it, but after a brave attempt, I've given up! There are too many differences between the versions. Tim Hunt has been busy improving the quiz module and this has introduced so many incompatibilities, that I would have to develop it again from the ground up. Also, the new role system places additional stumbling blocks in the way.

The good news is that I now have the random subset feature working. I'll post this tomorrow after I run it through a few more tests. See the graphic below for a preview.
Attachment orderingwithRandom.png
In reply to Thomas Robb

Re: Ordering -- Jan 1, 2007 version

by Eduardo Hernandez -
Hello!

Good question type, we would like to see it in action for 1.6.3 how could we help with this development?. I have tried installing it .. but it didn't work
In reply to Eduardo Hernandez

Re: Ordering -- Jan 1, 2007 version

by Thomas Robb -
Since so many people are still using 1.6, I've decided to build a version of the Ordering Q-type for it, as well. Look for a first release in the next few days.

--Tom
In reply to Thomas Robb

Re: Ordering -- Jan 1, 2007 version

by AjnabiZ ... -

Any news on the new Question type for Moodle 1.8.2 or 1.9