new UI javascript file not picked up

Re: new UI javascript file not picked up - control theory questions

by René van Paassen -
Number of replies: 0

I found out how to run this. Moodle is apparently transitioning to amd javascript, and in Moodle 3.8 all javascript is collected into one file and cached.

For Moodle 3.8 development, javascript caching has to be disabled, in config.php:

$CFG->cachejs = false;

After editing a javascript file, the compiled files have to be re-generated by running grunt.

I now have a modified coderunner version, with basically a confirmation feedback (in html) after check mode, right below the question. I modified renderer.php and allowed another output variable in combinator_grader_outcome.php

I added a user interface type called ui_practicon.js . In there I also triggered a MathJax re-run, in case MathJax is loaded (which apparently only happens when there is a formula in the main equation text), so that any equations near the question answer fields are rendered. It might be good to copy this to the ui_html.js template too. User interface fields are defined by JSON in the extra fields of the checks, I added these to the attributes of the main textarea.

Modified coderunner is on my github page at

Support for analysing and grading control theory answers (transfer function, state-space, matrix) and simple numerical and true-false answers as well, is on a separate repository: That code needs to run on the jobe backend, and needs python-control and slycot as well (to be found on github too!). I found I needed to increase memory for the jobe job, or run into mysterious error messages. 

The practicon repository contains two coderunner question templates. One for students leaving their answers right in Python3, as python variables (floats, transfer functions, state-space systems, etc.). 

The second question template uses the new ui_practicon.js, which can give the students answer fields to leave (paste) their results. The idea is that students use Matlab or Python + control module on their own computer to create their control theory answers. The parser accepts both Matlab-type and Python (list of list) type array/matrix input. 

I created this as future replacement for an older self-built solution we used here at TU Delft, and I hope it may be of interest to others too.