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

Fix bug with manualgraded options.

parent cb152df7
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,6 @@ Notes ...@@ -119,7 +119,6 @@ Notes
1. This test does not include laws of indices, so \(x\times x \neq x^2\). Since we are dealing only with nouns \(-\times -\) does not simplify to \(1\). E.g. \(-x\times -x \neq x\times x \neq x^2\). This also means that \(\sqrt{x}\) is not considered to be equivalent to \(x^{\frac{1}{2}}\) under this test. In many situations this notation is taken mean the same thing, but internally in Maxima they are represented by different functions and not converted to a canonical form by the test. Extra re-write rules could be added to achieve this, which would change the equivalence classes. 1. This test does not include laws of indices, so \(x\times x \neq x^2\). Since we are dealing only with nouns \(-\times -\) does not simplify to \(1\). E.g. \(-x\times -x \neq x\times x \neq x^2\). This also means that \(\sqrt{x}\) is not considered to be equivalent to \(x^{\frac{1}{2}}\) under this test. In many situations this notation is taken mean the same thing, but internally in Maxima they are represented by different functions and not converted to a canonical form by the test. Extra re-write rules could be added to achieve this, which would change the equivalence classes.
2. By design, addition commutes with subtraction, so \( -1+2\equiv 2-1\) and multiplication commutes with division, so \( (ab)/c\equiv a(b/c) \). 2. By design, addition commutes with subtraction, so \( -1+2\equiv 2-1\) and multiplication commutes with division, so \( (ab)/c\equiv a(b/c) \).
3. By design \(-1/4x \neq x/4\) since we do not have the rule \( 1\times x \rightarrow x\). To establish this equivalence we would need a different answer test. 3. By design \(-1/4x \neq x/4\) since we do not have the rule \( 1\times x \rightarrow x\). To establish this equivalence we would need a different answer test.
4. This test can also be used to establish \(\{4,4\} \neq \{4\}\), but \(\{1,2\} = \{2,1\}\) since the arguments of the set constructor function are commutative. Sets are not associative, so \(\{1,2\} \neq \{\{1\},2\}\). (See Maxima's `flatten` command.) 4. This test can also be used to establish \(\{4,4\} \neq \{4\}\), but \(\{1,2\} = \{2,1\}\) since the arguments of the set constructor function are commutative. Sets are not associative, so \(\{1,2\} \neq \{\{1\},2\}\). (See Maxima's `flatten` command.)
......
...@@ -604,9 +604,11 @@ class qtype_stack_question extends question_graded_automatically_with_countback ...@@ -604,9 +604,11 @@ class qtype_stack_question extends question_graded_automatically_with_countback
// TODO: we should probably give the whole ast_container to the input. // TODO: we should probably give the whole ast_container to the input.
// Direct access to LaTeX and the AST might be handy. // Direct access to LaTeX and the AST might be handy.
$teacheranswer = ''; $teacheranswer = '';
if (array_key_exists($name, $this->tas)) {
if ($this->tas[$name]->is_correctly_evaluated()) { if ($this->tas[$name]->is_correctly_evaluated()) {
$teacheranswer = $this->tas[$name]->get_value(); $teacheranswer = $this->tas[$name]->get_value();
} }
}
if (array_key_exists($name, $this->inputs)) { 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, $this->security, $rawinput); $response, $this->options, $teacheranswer, $this->security, $rawinput);
...@@ -670,6 +672,14 @@ class qtype_stack_question extends question_graded_automatically_with_countback ...@@ -670,6 +672,14 @@ class qtype_stack_question extends question_graded_automatically_with_countback
} }
public function is_gradable_response(array $response) { public function is_gradable_response(array $response) {
// Manually graded answers are always gradable.
if (!empty($this->inputs)) {
foreach ($this->inputs as $input) {
if ($input->get_extra_option('manualgraded')) {
return true;
}
}
}
// If any PRT is gradable, then we can grade the question. // If any PRT is gradable, then we can grade the question.
$noprts = true; $noprts = true;
foreach ($this->prts as $index => $prt) { foreach ($this->prts as $index => $prt) {
...@@ -708,6 +718,14 @@ class qtype_stack_question extends question_graded_automatically_with_countback ...@@ -708,6 +718,14 @@ class qtype_stack_question extends question_graded_automatically_with_countback
public function grade_response(array $response) { public function grade_response(array $response) {
$fraction = 0; $fraction = 0;
// If we have one or more notes input which needs manual grading, then mark it as needs grading.
if (!empty($this->inputs)) {
foreach ($this->inputs as $input) {
if ($input->get_extra_option('manualgraded')) {
return question_state::$needsgrading;
}
}
}
foreach ($this->prts as $index => $prt) { foreach ($this->prts as $index => $prt) {
if (!$prt->is_formative()) { if (!$prt->is_formative()) {
$results = $this->get_prt_result($index, $response, true); $results = $this->get_prt_result($index, $response, true);
......
...@@ -32,7 +32,6 @@ class stack_notes_input extends stack_input { ...@@ -32,7 +32,6 @@ class stack_notes_input extends stack_input {
); );
public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) { public function render(stack_input_state $state, $fieldname, $readonly, $tavalue) {
if ($this->errors) { if ($this->errors) {
return $this->render_error($this->errors); return $this->render_error($this->errors);
} }
...@@ -121,7 +120,9 @@ class stack_notes_input extends stack_input { ...@@ -121,7 +120,9 @@ class stack_notes_input extends stack_input {
'allowWords' => '', 'allowWords' => '',
'forbidFloats' => true, 'forbidFloats' => true,
'lowestTerms' => true, 'lowestTerms' => true,
'sameType' => true); 'sameType' => true,
'options' => '',
);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment