Skip to content

Commit

Permalink
Merge pull request maths#1352 from maths/iss1085
Browse files Browse the repository at this point in the history
Iss1085 - Debug block not displaying correctly in feedback
  • Loading branch information
sangwinc authored Jan 9, 2025
2 parents 48104f5 + befcf39 commit c81a735
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 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
5 changes: 3 additions & 2 deletions stack/cas/castext2/blocks/debug.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function compile($format, $options): ?MP_Node {
$castext .= "\n| `$key` | `{#$key,simp#}` | `{#$key,simp=false#}` | {@$key,simp@} | {@$key,simp=false@} |";
}
} else {
$castext = '<table><thead><th>[[commonstring key="castext_debug_header_key"/]]</th>' .
$castext = '<table class="table"><thead><th>[[commonstring key="castext_debug_header_key"/]]</th>' .
'<th>[[commonstring key="castext_debug_header_value_simp"/]]</th>' .
'<th>[[commonstring key="castext_debug_header_value_no_simp"/]]</th>' .
'<th>[[commonstring key="castext_debug_header_disp_simp"/]]</th>' .
Expand All @@ -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
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 c81a735

Please sign in to comment.