Skip to content

Commit

Permalink
iss1085 - Revert combining feedback variables. Update error message. …
Browse files Browse the repository at this point in the history
…Set debug block to not flat.
  • Loading branch information
EJMFarrow committed Jan 7, 2025
1 parent 9845eb8 commit 239faf0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lang/en/qtype_stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@
$string['castext_debug_header_value_no_simp'] = 'Value';
$string['castext_debug_header_disp_simp'] = 'Simplified displayed value';
$string['castext_debug_header_disp_no_simp'] = 'Displayed value';
$string['castext_debug_no_vars'] = 'This question has no question variables to debug!';
$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.';

$string['castext_error_header'] = 'Rendering of text content failed.';
$string['castext_error_unevaluated'] = 'This text content was never evaluated.';
Expand Down
1 change: 0 additions & 1 deletion questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -2529,7 +2529,6 @@ public function get_inputs_used_by_prt($prtname, $question) {
// Just do the full compile it does all the checking including feedback.
$compile['required'] = [];
try {
//$compile = $prt->compile($inputkeys, [], 0.0, new stack_cas_security(), '/p/0', new castext2_static_replacer([]));
$compile = $prt->compile($inputkeys, [], 0.0, new stack_cas_security(), '/p/0', null);
} catch (Exception $e) {
// Avoids dealing with an error in the PRT definition that a latter part handles.
Expand Down
3 changes: 2 additions & 1 deletion stack/cas/castext2/blocks/debug.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public function compile($format, $options): ?MP_Node {

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

// phpcs:ignore moodle.Commenting.MissingDocblock.Function
Expand Down
12 changes: 0 additions & 12 deletions stack/prt.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,6 @@ public function compile(array $inputs, array $boundvars, $defaultpenalty, $secur
// For the feedback we might want to provide extra information related to
// feedback vars. Basically, for the debug-block we tell that these are
// the bound ones.
// ISS1085 - Add question variables as well.
/* $bvars = array_merge($fv['references']['write']);
if (!empty($this->question->questionvariables)) {
$kv = new stack_cas_keyval($this->question->questionvariables);
if (!$kv->get_valid()) {
throw new stack_exception('Error(s) in question-variables: ' . implode('; ', $kv->get_errors()));
}
$c = $kv->compile('/qv', $map);
$bvars = array_merge($fv['references']['write'], $c['references']['write']);
}
$ct2options = ['bound-vars' => $bvars, 'static string extractor' => $map];
*/
$ct2options = ['bound-vars' => $fv['references']['write'], 'static string extractor' => $map];

if ($fv['statement'] !== null) {
Expand Down
5 changes: 4 additions & 1 deletion tests/walkthrough_adaptive_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4422,7 +4422,10 @@ public function test_test3_debug(): void {
$this->check_output_does_not_contain_prt_feedback();
$this->check_output_does_not_contain_stray_placeholders();
$this->check_current_output(
new question_pattern_expectation('/This question has no question variables to debug/'),
new question_pattern_expectation(
'/This question has no variables to debug here! ' .
'Display question variables in question text and feedback variables in node feedback./'
),
$this->get_does_not_contain_feedback_expectation(),
$this->get_does_not_contain_num_parts_correct(),
$this->get_no_hint_visible_expectation()
Expand Down

0 comments on commit 239faf0

Please sign in to comment.