Skip to content

Commit

Permalink
Set default value of step_info.preferredbehaviour to 'adaptive' rathe…
Browse files Browse the repository at this point in the history
…r than a meaningless 0.
  • Loading branch information
trampgeek committed Apr 18, 2024
1 parent 306c2f2 commit c2bbd17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -949,10 +949,10 @@ private function get_attached_files($response) {

private static function step_info($response) {
$stepinfo = new stdClass();
foreach (['numchecks', 'numprechecks', 'fraction', 'preferredbehaviour'] as $key) {
$value = isset($response[$key]) ? $response[$key] : 0;
$stepinfo->$key = $value;
foreach (['numchecks', 'numprechecks', 'fraction'] as $key) {
$stepinfo->$key = $response[$key] ?? 0;
}
$stepinfo->preferredbehaviour = $response['preferredbehaviour'] ?? 'adaptive';
$stepinfo->coderunnerversion = get_config('qtype_coderunner')->version;
return $stepinfo;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/check_twig_student_variable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Check the STUDENT Twig variable allows access to current username in Co
| id_answerboxlines | 5 |
| id_validateonsave | 0 |
| id_template | {{ STUDENT_ANSWER }} |
| id_answer | print("{{STUDENT.username}}" |
| id_answer | print("{{STUDENT.username}})" |
| id_iscombinatortemplate | 0 |
| id_testcode_0 | # This isn't used |
| id_expected_0 | {{ STUDENT.username }} |
Expand Down

0 comments on commit c2bbd17

Please sign in to comment.