Issue with new Parson's Problem question type

Issue with new Parson's Problem question type

von Richard Lobb -
Anzahl Antworten: 0

A correspondent emailed me the following question and I thought I should share my response.

I have been experimenting with the new Parsons problem question type in coderunner.
It's looking really good! Thank you so much for making this.

I've been having issues with the answer box and answer preload box when creating new questions.
When creating a new question and selecting the python3_parsons_problem question type, the answer and answer preload box display as greyed out and cannot be interacted with.

However, if I save the question and continue editing, the boxes display correctly.

Is this a known bug or is this something wrong with the way I am setting up the question or Moodle/Coderunner?

To which my answer was 

Thanks for raising this.

Yes, this a known issue and should have been documented. I've changed the prototype info (obtained via Question type details) to read as follows:

This prototype defines a simplified Parson's Problem question. To use:

  1. Create a new CodeRunner question.
  2. Select the python3_parsons_problem question type.
  3. Enter some text (possibly placeholder text only) into the question name, question text, and test case 1 expected output.
  4. Save the question.
  5. Open the Answer preload section.
  6. Paste into both the preload and the answer the code you want the student to construct.
  7. Add further distractor lines to the answer preload if desired.
  8. Use the Unindent and Shuffle buttons in the answer preload to get a suitable set of code lines.
  9. Save.

The slightly clumsy process in steps 1 through 4 is necessary because the prototype uses the HTML-UI and all the JavaScript to run the Parsons Problem is in the prototype. That code isn't loaded until the page gets refreshed at step 4. 

You can download the updated prototype from following the same link as you originally used. Please let me know if you have any issues.

This is not something that has an easy fix, sorry. The code to load the prototype is all in PHP so a page refresh is required. 

Implementing a complex question type using lots of JavaScript on top of the HTML-UI is a bit of a hack. A "proper" implementation would add a new UI plugin to CodeRunner so that the JavaScript was available immediately the question type was changed. But that's a much larger development step and I simply don't have time for that now.