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

test-7 question now marks "correct answer" as correct...

parent 068ba4cb
Branches
No related tags found
No related merge requests found
......@@ -101,8 +101,12 @@ class qtype_stack_renderer extends qtype_renderer {
* @return string Nicely formatted feedback, for display.
*/
protected function prt_feedback($qa, $question, $result) {
$err = '';
if (array_key_exists('errors', $result)) {
$err = $result['errors'];
}
return html_writer::nonempty_tag('div',
$this->standard_prt_feedback($qa, $question, $result) . $result['feedback'],
$this->standard_prt_feedback($qa, $question, $result) . $err . $result['feedback'],
array('class' => 'stackprtfeedback'));
}
......
......@@ -424,7 +424,8 @@ class qtype_stack_test_helper extends question_test_helper {
'lv = length(l); ' .
'b1 = ev(ans1,t=0,fullratsimp); ' .
'b2 = ev(ans1,t=1,fullratsimp); ' .
'm = float(if b2#0 then fullratsimp(b1/b2) else 0)');
'm = float(if not(equal(b2,0)) then fullratsimp(b1/b2) else 0)',
null, 0, 't');
$sans = new stack_cas_casstring('sa3');
$sans->get_valid('t');
......@@ -462,7 +463,7 @@ class qtype_stack_test_helper extends question_test_helper {
'Not two lin ind parts');
$q->prts['Result'] = new stack_potentialresponse_tree('Result', '',
true, 1, null, array($node0, $node1, $node2));
true, 1, $feedbackvars->get_session(), array($node0, $node1, $node2));
return $q;
}
......
......@@ -216,6 +216,7 @@ class stack_cas_text {
$cmd = stack_utils::trim_commands($cmd);
$cs = new stack_cas_casstring($cmd);
$cs->validate($this->security, $this->insertstars, $this->syntax);
$key = 'caschat'.$i;
$i++;
......@@ -223,7 +224,7 @@ class stack_cas_text {
$cs->set_key($key, true);
$cmdarray[] = $cs;
$valid = $valid && $cs->get_valid($this->security, $this->insertstars, $this->syntax);
$valid = $valid && $cs->get_valid();
$errors .= $cs->get_errors();
}
......
......@@ -122,7 +122,6 @@ class stack_potentialresponse_tree {
}
$cascontext->instantiate();
//TODO error trapping at this stage....?
return $cascontext;
}
......@@ -149,7 +148,7 @@ class stack_potentialresponse_tree {
$results = array(
'feedback' => array(),
'answernote' => array(),
'errors' => '',
'errors' => $cascontext->get_errors(),
'valid' => true,
'score' => 0,
'penalty' => 0,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment