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

Fix bug in question testing logic, update demo course and docs.

parent 6003b473
No related branches found
No related merge requests found
No preview for this file type
...@@ -29,6 +29,7 @@ STACK is released in many languages, using Moodle's ATOS language system. ...@@ -29,6 +29,7 @@ STACK is released in many languages, using Moodle's ATOS language system.
* EN: English (British), by Chris Sangwin (and others) * EN: English (British), by Chris Sangwin (and others)
* FI: Finnish, by Matti Pauna * FI: Finnish, by Matti Pauna
* SV: Swedish, by Mikael Kurula * SV: Swedish, by Mikael Kurula
* DA: Danish, by Malthe Sporring
* ES: Spanish, by Victor Hugo Huerta * ES: Spanish, by Victor Hugo Huerta
* JA: Japanese, by Yasuyuki Nakamura and Takahiro Nakahara * JA: Japanese, by Yasuyuki Nakamura and Takahiro Nakahara
......
No preview for this file type
...@@ -157,16 +157,19 @@ class stack_question_test_result { ...@@ -157,16 +157,19 @@ class stack_question_test_result {
$state->testoutcome = false; $state->testoutcome = false;
$reason[] = stack_string('score'); $reason[] = stack_string('score');
} }
// If the expected penalty is null, then we use the question default penalty. // If the expected penalty is null then we use the question default penalty.
$penalty = $state->expectedpenalty; $penalty = $state->expectedpenalty;
if (is_null($state->expectedpenalty)) { if (is_null($state->expectedpenalty)) {
$penalty = $this->questionpenalty; $penalty = $this->questionpenalty;
} }
// If we have a "NULL" expected answer note we just ignore what happens to penalties here.
if ('NULL' !== $state->expectedanswernote) {
if (is_null($state->penalty) || if (is_null($state->penalty) ||
abs($penalty - $state->penalty) > 10E-6) { abs($penalty - $state->penalty) > 10E-6) {
$state->testoutcome = false; $state->testoutcome = false;
$reason[] = stack_string('penalty'); $reason[] = stack_string('penalty');
} }
}
if (!$this->test_answer_note($state->expectedanswernote, $actualresult->answernotes)) { if (!$this->test_answer_note($state->expectedanswernote, $actualresult->answernotes)) {
$state->testoutcome = false; $state->testoutcome = false;
$reason[] = stack_string('answernote'); $reason[] = stack_string('answernote');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment