Code actions

If you need more control for checking the answers of the students and to generate feedback, you can use code actions. A code action is simply a block of JavaScript code that will be executed by our server in a sandbox environment when a student requests feedback. You can type the code using the provided code editor, which supports JavaScript syntax highlighting. This code can basically do any processing you like, although for safety reasons certain things are disabled, such as file system access. Inside the code you can use the qf object. This object contains a number of properties about the exercise, answer, and student, that your code can use. You can also change and add properties to this object. In conditions for feedback these added properties can then be used.

For example, to base feedback on the fact whether an open answer contains the term "functional", you could write the following piece of code.

In a conditional feedback action you now simply check for the variable functional, as follows.

We will regularly extend the functionality available in the qf object and in code to accommodate the needs of the teachers.

You are recommended to only define properties in code and generate the actual feedback in the feedback actions. However, if you insist on creating the feedback directly in the code you can do this by directly adding texts to the feedback property of the qf object, which is an array of strings representing the feedback generated until now.

Still need help? Contact Us Contact Us