Skip to content

Commit 239faf0

Browse files
committed
iss1085 - Revert combining feedback variables. Update error message. Set debug block to not flat.
1 parent 9845eb8 commit 239faf0

5 files changed

Lines changed: 7 additions & 16 deletions

File tree

lang/en/qtype_stack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@
15441544
$string['castext_debug_header_value_no_simp'] = 'Value';
15451545
$string['castext_debug_header_disp_simp'] = 'Simplified displayed value';
15461546
$string['castext_debug_header_disp_no_simp'] = 'Displayed value';
1547-
$string['castext_debug_no_vars'] = 'This question has no question variables to debug!';
1547+
$string['castext_debug_no_vars'] = 'This question has no variables to debug here! Display question variables in question text and feedback variables in node feedback.';
15481548

15491549
$string['castext_error_header'] = 'Rendering of text content failed.';
15501550
$string['castext_error_unevaluated'] = 'This text content was never evaluated.';

questiontype.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,6 @@ public function get_inputs_used_by_prt($prtname, $question) {
25292529
// Just do the full compile it does all the checking including feedback.
25302530
$compile['required'] = [];
25312531
try {
2532-
//$compile = $prt->compile($inputkeys, [], 0.0, new stack_cas_security(), '/p/0', new castext2_static_replacer([]));
25332532
$compile = $prt->compile($inputkeys, [], 0.0, new stack_cas_security(), '/p/0', null);
25342533
} catch (Exception $e) {
25352534
// Avoids dealing with an error in the PRT definition that a latter part handles.

stack/cas/castext2/blocks/debug.block.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public function compile($format, $options): ?MP_Node {
7474

7575
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
7676
public function is_flat(): bool {
77-
return true;
77+
//ISS1085 - Change to false. Common strings need to be evaluated.
78+
return false;
7879
}
7980

8081
// phpcs:ignore moodle.Commenting.MissingDocblock.Function

stack/prt.class.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,6 @@ public function compile(array $inputs, array $boundvars, $defaultpenalty, $secur
441441
// For the feedback we might want to provide extra information related to
442442
// feedback vars. Basically, for the debug-block we tell that these are
443443
// the bound ones.
444-
// ISS1085 - Add question variables as well.
445-
/* $bvars = array_merge($fv['references']['write']);
446-
if (!empty($this->question->questionvariables)) {
447-
$kv = new stack_cas_keyval($this->question->questionvariables);
448-
if (!$kv->get_valid()) {
449-
throw new stack_exception('Error(s) in question-variables: ' . implode('; ', $kv->get_errors()));
450-
}
451-
$c = $kv->compile('/qv', $map);
452-
$bvars = array_merge($fv['references']['write'], $c['references']['write']);
453-
}
454-
$ct2options = ['bound-vars' => $bvars, 'static string extractor' => $map];
455-
*/
456444
$ct2options = ['bound-vars' => $fv['references']['write'], 'static string extractor' => $map];
457445

458446
if ($fv['statement'] !== null) {

tests/walkthrough_adaptive_test.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4422,7 +4422,10 @@ public function test_test3_debug(): void {
44224422
$this->check_output_does_not_contain_prt_feedback();
44234423
$this->check_output_does_not_contain_stray_placeholders();
44244424
$this->check_current_output(
4425-
new question_pattern_expectation('/This question has no question variables to debug/'),
4425+
new question_pattern_expectation(
4426+
'/This question has no variables to debug here! ' .
4427+
'Display question variables in question text and feedback variables in node feedback./'
4428+
),
44264429
$this->get_does_not_contain_feedback_expectation(),
44274430
$this->get_does_not_contain_num_parts_correct(),
44284431
$this->get_no_hint_visible_expectation()

0 commit comments

Comments
 (0)