Skip to content

Commit

Permalink
Fix to issue maths#1311: send general feedback to CAS broke for equiv…
Browse files Browse the repository at this point in the history
… inputs and textarea.
  • Loading branch information
sangwinc committed Nov 14, 2024
1 parent dfdb428 commit 7df69e9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adminui/caschat.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
$simp = '';
}
$questionvarsinputs = '';
foreach ($question->get_correct_response() as $key => $val) {
foreach ($question->get_correct_response_testcase() as $key => $val) {
if (substr($key, -4, 4) !== '_val') {
$questionvarsinputs .= "\n{$key}:{$val};";
}
Expand Down
15 changes: 15 additions & 0 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,21 @@ public function get_correct_response() {
return $teacheranswer;
}

/*
* This function returns an array of values for inputs which could be typed into Maxima.
* Used in the caschat function as possible input values.
*/
public function get_correct_response_testcase() {
$teacheranswer = [];
if ($this->runtimeerrors || $this->get_cached('units') === null) {
return [];
}
foreach ($this->inputs as $name => $input) {
$teacheranswer[$name] = $input->get_teacher_answer_testcase($this->tas[$name]->get_dispvalue());
}
return $teacheranswer;
}

public function is_same_response(array $prevresponse, array $newresponse) {
foreach ($this->get_expected_data() as $name => $notused) {
if (!question_utils::arrays_same_at_key_missing_is_blank(
Expand Down
2 changes: 1 addition & 1 deletion samplequestions/input-sample-questions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ ta:append(ta,[tao]);]]></text>
<text><![CDATA[<p>Solve {@p@}.</p><p>[[input:ans1]] [[validation:ans1]]</p>]]></text>
</questiontext>
<generalfeedback format="html">
<text><![CDATA[<p>sangwinc<br></p>]]></text>
<text></text>
</generalfeedback>
<defaultgrade>1.0000000</defaultgrade>
<penalty>0.1000000</penalty>
Expand Down

0 comments on commit 7df69e9

Please sign in to comment.