limit to one answer

limit to one answer

by Boaz Miller -
Number of replies: 8

Hi,

I'd like to limit students attempts to answer a question to a single attempt. That is, I want them to submit, get feedback and a grade, without being able to submit again or change the answer. I've tried setting the penalty to 100, but it still allows them to write a new answer. I've tried changing the feedback options on the quiz to no avail.

Help would be appreciated.

Thanks,

Boaz

In reply to Boaz Miller

Re: limit to one answer

by Richard Lobb -

CodeRunner was designed right from the start to operate in an adaptive mode. See my original rant on the topic: https://github.com/trampgeek/moodle-qtype_coderunner#appendix-2-how-programming-quizzes-should-work

Hence, the mode you're asking for isn't really available out of the box. But there may be ways or workarounds of getting most of what you want. Can I ask: what is the problem with questions that have a 100% penalty? Students certainly can't get more marks by resubmitting after the first attempt, so what is that you're trying to prevent?

In reply to Richard Lobb

Re: limit to one answer

by Boaz Miller -

It's a relatively big exercise in JDBC where the students need to extract and  process data from a database. The data isn't clean and the challenge is to identify and handle all the edge cases and follow instructions to the letter. In this case, I don't want them to reverse engineer all the edge cases from my tests, or to prevent an SQL injection *after* the test exposed their code vulnerability. I created another CodeRunner box with minimal tests that they can use to see that they're on the right track, but once they are confident they have tested all the edge cases, I'd like them to submit once only and get a grade.

In reply to Boaz Miller

Re: limit to one answer

by Henry Hickman -
It sounds to me like hiding the Check button (and having a pre-check for sanity's sake) would fit the bill. This would mean students could use pre-check for syntax errors (or whatever else you let pre-check check) but their code wouldn't be run against any test cases until they submit their quiz, or the quiz closes.

Another option is only running very basic tests during the quiz, and then loading the more complex test cases later, and doing a re-grade. We do that in some of our courses when we want students to have an idea if they're failing very basic test cases, but not if they're failing edge ones. This does have the downside of students believing they have a higher mark than they actually do at the end.

If you really want to disable the check button, I've done something similar, but only in a customised Python question type, I do not know if it transfers to JDBC. The Twig variable QUESTION (mentioned here under the heading "The Twig Question Variable" https://github.com/trampgeek/moodle-qtype_coderunner) has a field called stepinfo. This in turn has the attribute numchecks. Using a combinator grader template, you can check if numchecks is greater than your threshold, and if so set the outcome json's prologue equal to a bit of JavaScript that disables to Check button.
My implementation looked like:

params['STEP_INFO'] = json.loads(r"""{{ QUESTION.stepinfo | json_encode }}""")
self.num_checks = params["STEP_INFO"]["numchecks"]
if self.num_checks == 2 and self.params['forassessment']:
prologue = ""
outcome[prologuehtml] = prologue

Which stopped students after 3 checks. I'm not entirely sure if this option would work, but thought I'd put it into the world!
(I personally think option 1 or 2 are far nicer and cleaner, we had to implement option 3 as high school students absolutely love repeatedly clicking check even after getting a 100% penalty).
In reply to Henry Hickman

Re: limit to one answer

by Henry Hickman -
I completely missed pasting the actual important part of my code there...


prologue = "<script>\
const currentScript = document.currentScript;\\
const parentDiv = currentScript.parentElement.parentElement.parentElement.parentElement.parentElement;\
const buttons = parentDiv.getElementsByClassName('btn-primary');\
buttons[0].disabled = true;\
</script>"

This is the JavaScript that when injected into prologuehtml disables the check button
In reply to Henry Hickman

Re: limit to one answer

by Boaz Miller -
Thank you, this solved my problem
In reply to Boaz Miller

Re: limit to one answer

by Asset Berdibek -
Sorry for reasking, but I'm trying to do the same thing, disable the check button, but I'm completely lost.

Can you elaborate on what you added and where exactly in the question settings?
In reply to Asset Berdibek

Re: limit to one answer

by Richard Lobb -
Are you just trying to hide the check button all the time, or only when certain conditions have been satisfied (e.g. a 100% penalty has been reached)?

The first one is very easy - just click the Hide check button:

Screenshot show Hide check button.

Henry's posting was also explaining how to set up JavaScript to hide the check button when certain conditions are met. That's much harder. If you want that option, please post back telling us what under what conditions you wish to hide the check button.
In reply to Richard Lobb

Re: limit to one answer

by Asset Berdibek -
I want the check button become hidden after students click it 3 times.

I guess it's impossible unless I use a template grader instead of the exact match, right?

Could you please tell me how it can be done step by step?