Logic for Drag and Drop Quiz Moodle 2.5

Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -
Number of replies: 22

Hello,

I got started on this and suddenly realized I wasn't sure how I could do it.

The goal is to use a drag and drop onto image where each of the answer statements (in black in the uploaded file) can be dragged onto the appropriate columns (in red in the uploaded file).

Problem is that the order in which items are dragged into a column does not permit them to hold a unique location in that column. It's got to be more like a "column zone" and any item associated with that "column" needs to stick if it is within that range.

Any ideas? Thanks.

Rod

Attachment TTCP-ITCP_comparisonTable2.png
Average of ratings: -
In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jamie Pratt -

So for any drag item they need to be dropped somewhere within the correct column. Order that they are dropped onto the column does not matter?

If I have understood your requirements properly then one way to go is to use the drag and drop markers question type not the drag and drop onto image question type which won't do what you want here. Using the drag and drop markers question type you can then define rectangular drop zones that cover the whole column. And associate the drag items to the correct drop zone.

I guess a potential gotcha for this type of question would be that you would be defining the drop zone thinking about where the whole drag item should be dragged to; whereas in actual fact the student is graded correct when they drag the drag item so that the cross hairs ends up in the defined drop zone. So you might want to define your drop zone going a little to the left and above the column area and coming down to maybe midway across the column. I would play about with it and see what works well for you.

Another alternative would be to use the drag and drop to image question type or drag and drop into text question type. But using these question types the students would need to know which order to order the drag items in the columns by. You might specify that they should put the items in alphabetical order for example, or you might include a number "1. Required by MUTCD" for example, so that they know which row to drag an item to too. Unfortunately for these two question types there is as yet no way to say the student gets full marks if they drag this item to drop zone 1,2,3 or 4, for example, so that you could mark them correct where ever they dragged the item to in the column.

In reply to Jamie Pratt

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jamie Pratt -

I expect the drag and drop matching question might work well for you testing this kind of knowledge and might be a better fit for you. Hopefully Jean-Michel Védrine will see this discussion and comment.

Average of ratings: Useful (1)
In reply to Jamie Pratt

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jean-Michel Védrine -

Hello,

Yes this kind of question can be done with the drag and drop matching question type. Here is an example (sorry, I didn't bother to type all the items in the left column smile)

When creating the question, you must be very careful to type items for the left column (Temporary Traffic control Plan, Internal Traffic Control Plan, Both) always exactly the same way.

Drag and drop quiz

The drag and drop matching question is available here and I am quite happy to report it is now translated to German, Spanish, Hebrew and of course French. Please, if you use some Moodle questions type addons (or other Moodle plugins), contribute to translate them into your language using http://lang.moodle.org portal.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Thanks to both of you - Jean Michel and Jamie.

I think this is going to work perfectly. Would have preferred  a columnar format to make it clearer to trainees to which category each concept belonged. But that said, this is still a great solution. I thank you both for taking the time to direct me to it. I am implementing the solution right now!

Regards,

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hello Again,

An interesting issue. I have installed the drag and drop matching question and the header when editing the question says it is a drag and drop matching question. (marked as 1. in the image). But when the question displays, it is displaying as a typical matching question with the choose box next to each item (marked as 2. in the image).

Is this because of the Rocket theme? Or perhaps because I have the Bootstrap Styling enabled? I will test, but thought you might like to know, if nothing else.

Regards,

Rod

Attachment Drag_Drop_Matching_Problem1.png
In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

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

I just tried this on 2.5 with Rocket theme and it worked just perfectly. Hopefully that will help you narrow it down.  You might try reinstalling maybe?

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

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

Just noticed that in the description, you tell students to select from drop down?  Is this something you added or are you maybe previewing an old question that it just a regular match?

In reply to Emma Richardson

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hi,

When I couldn't get it working properly, I changed the description to match what I was getting. The question was generated fresh for this drag-and-drop module. Thanks for testing in Rocket, that eliminates that problem. I also tried with a standard theme. Would you mind checking in Rocket with the Bootstrap Styling turned on?

Thanks for your review.

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

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

Turned bootstrap styling on and it still displays correctly.

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jean-Michel Védrine -

Hello,

That's unexpected. I am not able to test with the Rocket theme as I don't have it installed, but drag and drop matching has been tested with Clean theme based on Bootstrap and it works (I just verified a moment ago it still works).

Just to be sure it isn't a theme issue, could you try with a standard theme ?

Drag and drop matching should be compatible with all modern browsers (of course javascript needs to be enabled, but that is to be expected for a drag and drop question !) here also just to be sure it isn't a browser issue could you try with a different browser ?

 

 

In reply to Jean-Michel Védrine

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hello,

I did try it with a standard theme (afterburner). Also disabled the bootstrap and ran it in chrome, IE, and Firefox. Also Emma ran it with Rocket. So that doesn't seem like it could be the issue.

I will uninstall the program and try to reinstall it. Wonder what is going on? Sounds more and more like it must be something on my system.

Thanks,

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

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

I am presuming you have tried deleting and recreating the question first?  Or trying another more simple question maybe?  

In reply to Emma Richardson

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Emma,

Did try a new simple question. Same result. I will now uninstall and reinstall the plug-in.

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jean-Michel Védrine -

Looking at the code rendering the question, I suddently remember that drag an drop is disabled if AJAX is disabled on the Moodle website.

So go to Site Administration -> Apparence -> AJAX and Javascript and verify that Enable AJAX is set to yes (this is the default value).

Tim, do you think this is the right thing to do ? The previous version (Adriane code) was trying to see if the browser supported drag and drop (browser sniffing) which seems no more necessary now, and Andrew changed that to:

   /**
     * Check whether drag and drop is supported
     *
     * @return boolean Whether or not to generate the drag and drop content
     */
    protected function can_use_drag_and_drop() {
        global $USER, $CFG;

        // Note: The screenreader setting no longer exists from Moodle 2.4.
        if (!$CFG->enableajax || !empty($USER->screenreader)) {
            return false;
        }
        return true;
    }

But I don't see the point to tie drag and drop in a question to that admin setting ?

In reply to Jean-Michel Védrine

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Jean-Michel,

I did check to see if AJAX was enabled. It was and all items in that section are set to the default values.

I have also cleared caches, just in case; have tried a simpler question (Emma's suggestion); and started to uninstall the plugin and do a reinstall -- but got a message that I would have to delete the existing questions, so thought about trying more, other options first.

In your discussion about the code, I couldn't help notice a mention of screenreader. Our materials must be 508 complaint (U.S. Federal Disabilities Act Law) and we have made efforts to achieve this compliance including using OOHOO - TTS - Text To Speech plugin. I can't imagine that could have any impact!?

Last points to make, a reminder that I am using Moodle 2.5.1 with Rocket 2.5 theme and bootstrap enabled. Also, here is partial image of my question plugins. It seems to show all installed properly, with proper dependents in place.

A mystery? n'est pas?

Regards and appreciation for your assistance.

Rod

Attachment Drag_Drop_Matching_Problem2.png
In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

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

Can you disable the text to speech plugin and see if that resolves it?  Also, maybe try from a different computer just to make sure that it isn't a computer specific issue.

In reply to Emma Richardson

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hello Emma,

I did disable the TTS. It did not have an effect. I also tried access to question from two other machines. No difference.

I have provided the page source to Jean-Michele. Hopefully he will see something that makes a difference,

Regards,

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jean-Michel Védrine -

Thanks for the screenshot,

It shows that you have the right versions installed.

I tested with Moodle 2.5.1 too, but would be interested to test with Rocket 2.5 theme, is this a freely available theme ?

I don't think text to speach could be an issue.

Is drag and drop working in other areas of your Moodle ? For instance if you turn editing mode on in a course, can you drag and drop files onto sections ?

If you could save the page source code on a page where the question is displayed during an attempt or a preview and mail it to me (vedrine _at_ vedrine _dot_net) it would be interesting to see if the code for drag and drop is present or not.

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hello Jean-Michele,

Responses to the issues you raise:

1) Here is the 2.5 release for Rocket theme. https://moodle.org/plugins/pluginversions.php?plugin=theme_rocket

2) I did disable speech, as Emma suggested. It made no difference.

3) Yes, I am able to "drag and drop" a graphic into a lesson.

4) I have attached a zip document that contains the page source on the question in question. If something else is needed I would be happy to provide it. I have not yet reinstalled the plug. I will wait to hear your verdict!

Merci bien de votre assistance,

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Jean-Michel Védrine -

Hello Rodney,

Thanks a lot for all these informations.

I was able to install the Rocket theme 2.5 version ad the ddmatch question is working as expected even with Bootstrap activated. The drag and drop UI is displayed on screen and works.

Studying your page source code, it's quite evident that the needed code for the ddmatch drag and drop interface is not here. So now, "all" that is needed is to find why it is not here.

  1. Verify that the file question/type/ddmatch/yui/dragdrop/dragdrop.js is present on your moodle server and not corrupted (this file contains 158 lines).
  2. Replace the question/type/ddmatch/renderer.php file on your server with the one included in the zip archive attached to this message (I have edited it so that the can_use_drag_and_drop function always return true) and purge all caches both on the server going to Site Administration -> Development -> Purge all caches, and also in your browser. See if it makes any difference.
  3. Go to Site administration -> Development -> Debugging and set Debugging Messages level to DEVELOPER, don't forget to click on "Save all changes" smile, display a ddmatch question and see if any error message is displayed.

That's all I can suggest for now !

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Hello Jean-Michel,

Voilà !  Un succès fou! Thanks so very much.

However, the question remains, why? The .js was the right length, 158 lines. And I had always previously cleared cache after making any code adjustment or even when adding a new plugin. I am wondering if I should try putting back the old renderer.php sometime (didn't check to see if you had merely commented out the old code, but did notice the file you sent was about 20 KB shorter.

This method for displaying the question is so much better than a straight match.

Regards,

Rod

In reply to Rodney Wolford

Re: Logic for Drag and Drop Quiz Moodle 2.5

by Rodney Wolford -

Actually, one last question.

Where in the .css or other code could I adjust the widths of the drag box, drop box, and text description areas? I can see if these were controlled that I would be able to make the question fit better on the page.

Thanks again,

Rod