Drag and drop on image - Displaying the answer

Drag and drop on image - Displaying the answer

by Daniel Williams -
Number of replies: 1

I have a suggestion and, after speaking, with Tim about it, he said that it would be possible and a small task. He advised me to put it out there and see if anyone would be interested in building it - he would advise and implement the change.

I have the question type plugin for dragging and dropping onto an image. I love it, but there's one thing that would really help me and anyone else who just doesn't have time to implement the workaround.

Issue: This involves an image that needs to be labeled. Our company has hardware and the technicians need to identify parts of that hardware. They would drag and drop the labels. However, if they get it wrong, nothing tells them what the correct answer, and a trainer may not be present to do so (if they're taking this test remotely).

Workaround: Take a screenshot of the image with the correct answers, and place that in the general feedback, but a) if they get it right, that would always display, and b) it takes time to do all of that (granted, not a lot for one, but for several, it adds up).

Request: The image with the correct labels (text or graphic) appears if they get it wrong.

Average of ratings: -
In reply to Daniel Williams

Re: Drag and drop on image - Displaying the answer

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

If anyone wants to try this, then in https://github.com/moodleou/moodle-qtype_ddimageortext/blob/master/renderer.php, you will need to add an implementation of the correct_response method https://github.com/moodle/moodle/blob/master/question/type/rendererbase.php#L180 to render the background image with the correct drag items in the right places.