Skip to content
Snippets Groups Projects
Commit f0dee566 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Checks to ensure an input really *still* exists in a question. (Edit existing...

Checks to ensure an input really *still* exists in a question.  (Edit existing question, remove one input then attempt to run question tests.  System crashes as this input field no longer exists)
parent b18ca57b
Branches
No related tags found
No related merge requests found
...@@ -401,11 +401,13 @@ class qtype_stack_question extends question_graded_automatically_with_countback ...@@ -401,11 +401,13 @@ class qtype_stack_question extends question_graded_automatically_with_countback
$forbiddenkeys = $this->session->get_all_keys(); $forbiddenkeys = $this->session->get_all_keys();
$teacheranswer = $this->session->get_value_key($name); $teacheranswer = $this->session->get_value_key($name);
if (array_key_exists($name,$this->inputs)) {
$this->inputstates[$name] = $this->inputs[$name]->validate_student_response( $this->inputstates[$name] = $this->inputs[$name]->validate_student_response(
$response, $this->options, $teacheranswer, $forbiddenkeys); $response, $this->options, $teacheranswer, $forbiddenkeys);
return $this->inputstates[$name]; return $this->inputstates[$name];
} }
return '';
}
/** /**
* @param array $response the current response being processed. * @param array $response the current response being processed.
......
...@@ -138,8 +138,10 @@ class stack_question_test { ...@@ -138,8 +138,10 @@ class stack_question_test {
if ('' == $computedinput) { if ('' == $computedinput) {
$computedinput = $inputs[$name]; $computedinput = $inputs[$name];
} }
if (array_key_exists($name,$question->inputs)) {
$response = array_merge($response, $question->inputs[$name]->maxima_to_response_array($computedinput)); $response = array_merge($response, $question->inputs[$name]->maxima_to_response_array($computedinput));
} }
}
return $response; return $response;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment