Question Authors' Forum

Announcing CodeRunner V3.4.0

Picture of Richard Lobb
Announcing CodeRunner V3.4.0
by Richard Lobb - Saturday, 28 April 2018, 9:23 PM

CodeRunner 3.4.0 is now available either through the Moodle plugins repository or from github.

The most important new feature is the addition of a question randomisation capability. This allows authors to set questions with in-built variability so that different students see different variants of a question. For details see the Randomising Questions section of the documentation.

Another new feature requested by several users is the addition of a Reset answer button to questions that have preloaded content in the answerbox. A student who has modified and submitted the initial contents, but who now wishes to revert to the original supplied skeleton answer (say) can simply click the Reset answer button.

The full set of changes is as follows:


28 April 2018. 3.4.0
  • Add randomisation capabilities so that students can be presented with a randomly generated question variant when they start a question in a quiz. Randomisation is achieved by the use of Twig expansion of the template parameters field (assumed to include at least one call to the Twig random function) followed by Twig expansion of all other question fields using the expanded template parameters as a Twig environment. For details see here.
  • Add a Reset answer button to the student question answer page if the answer box contains preloaded content.
  • Add function set_random_seed to Twig for use with the question randomisation, e.g. to ensure that a student always sees the same variant of a question no matter how often they attempt it.
  • Add id field to the Twig STUDENT variable, e.g. for use with the above.
  • Use Ace editor for template-parameters field.
  • Add Twig All and Hoist template parameters checkboxes to the authoring interface for use with randomisation and to simplify template authoring in general.
  • Add fontsize parameter to the GraphUI plugin.
  • Fix a long-standing bug that caused questions to be flagged as incomplete after earlier having been marked correct even though the answer had not been altered. This turned out to occur if the student's answer began with a blank line.
  • Improve question author feedback in the event of Twig errors.
  • Miscellaneous code-cleaning and minor bug fixes.


Picture of Martin Zwerschke
Re: Announcing CodeRunner V3.4.0
by Martin Zwerschke - Friday, 11 May 2018, 10:52 AM

It seems to me, that the feature "Show Differences" for the "Expected" in comparison to the "Got" Boxes has vanished since last upgrade.

Or can it be enabled / disabled and I don't see where?

Or does it only appear in certain situations?

Picture of Richard Lobb
Re: Announcing CodeRunner V3.4.0
by Richard Lobb - Friday, 11 May 2018, 11:57 AM

The Show Differences button should be presented if an answer is not marked fully correct and there is at least one non-hidden failing test case and one of the following applies:

  1. The grader is either the EqualityGrader or the NearEqualityGrader, or
  2. The grader is a TemplateGrader and it's a combinator template and the JSON response has a showdifferences attribute set to true.

Please let me know if you have a counter example.


Picture of Martin Zwerschke
Re: Announcing CodeRunner V3.4.0
by Martin Zwerschke - Saturday, 12 May 2018, 2:13 AM

Unfortunately, I think I have. 

Look at attachements.

Picture of Richard Lobb
Re: Announcing CodeRunner V3.4.0
by Richard Lobb - Saturday, 12 May 2018, 11:26 AM

Nice to see a fully-translated German CodeRunner site, Martin. Looks great :-)

But therein lies the problem. It turns out there was another condition for the button to be displayed, namely that the result table has two columns headed 'Expected'  and 'Got'. Which of course doesn't happen on a German language site! This isn't a new bug - it has always been like that, but you've only just hit it as a result of translating all the language strings.

I've fixed it (I hope) in my development system by using the correct language strings. The fix will appear when I next merge and push the master. In the mean time, if you want to live on the bleeding edge you could pull the latest development branch from github.

Thanks for reporting