Question Authors' Forum

Is it possible to display question author's solution immediately after a successful attempt?

Is it possible to display question author's solution immediately after a successful attempt?

by Richard Moreham -
Number of replies: 2

Hi there

I'm something of a newbie to CodeRunner, but finding it very useful for simple Python and SQL quiz questions.  The immediate feedback that compares their solution to the expected output is very useful, but is it also possible to immediately display the question author's solution - either once they have submitted a correct answer or possibly after a certain number of failed attempts?

The question author's solution for each question is available once the whole quiz is submitted, but it would be helpful for instructional quizzes if students could see this while they are working on each question.

I am only using the standard templates for each question type and have not investigated the customisable architecture behind them, but if this can be customised some pointers for where to begin would be much appreciated.

Cheers,  Richard 

In reply to Richard Moreham

Re: Is it possible to display question author's solution immediately after a successful attempt?

by Tim Hunt -

This is something we want at the OU (mainly in the context of using CodeRunner with our embedded question plugin https://moodle.org/plugins/filter_embedquestion).

And, it has come up before here, for example:

Actually doing this, rather than discussing it, is moving closer to the top of my todo list, but it is not quite there yet.
In reply to Richard Moreham

Re: Is it possible to display question author's solution immediately after a successful attempt?

by Richard Lobb -

What language are you teaching? We have been offering students the question author's answer in our Python course for the last month or two and it's going very well. Here's what the student sees after a correct submission:

Before clicking the button

And if they click the Show author's solution button, they see:

After clicking the button

Our Python3 question type can be found in the repo https://github.com/trampgeek/ucquestiontypes - it's called python3_stage1. If you download and import the xml file you should be able to create questions of type python3_stage1. If you open up the Question type details section of the author form, you'll see lots of template parameters; the one that turns on this feature is called showfeedbackwhenright (which is a bit of misnomer - it originally displayed the contents of the Feedback panel, but we found we were always just displaying the sample answer). You'll find you don't get the syntax colouring of the author's answer - that's another local feature that allows us to use the Ace static highlighter to colour code anywhere (thanks Matthew Toohey). But it should otherwise work - let me know if not.

I attach the xml export of the above question in case you need it.

Our question type also offers to show a scrambled version of the authors answer, with indentation removed, after a certain number of wrong submissions. This is the template parameter parsonsproblemthreshold. It's relatively straightforward to change that to show the full author's answer instead if that's what you want. 

If you want a language other than Python you have a lot of work to do, because you need to understand how to take complete control of the feedback by using a custom template grader. Not an exercise for the faint-hearted. But let us know what you want - we might be able to help. A lot of the framework for handling different languages is in place already and we use it for C.

Richard