Skip to content

Commit b7abfe6

Browse files
committed
Bug fix: STUDENT and QUIZ Twig variables were not available for use within the template itself.
1 parent 883d74e commit b7abfe6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

question.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public function evaluate_template_params($templateparams, $lang, $seed) {
418418
$this->cachedfuncparams === ['lang' => $lang, 'seed' => $seed]
419419
) {
420420
// Use previously cached result if possible.
421+
421422
$jsontemplateparams = $this->cachedevaldtemplateparams;
422423
} else {
423424
$lang = strtolower($lang); // Just in case some old legacy DB entries escaped.
@@ -513,7 +514,7 @@ private function evaluate_template_params_on_jobe($templateparams, $lang, $seed)
513514
// initialisation when evaluating the template parametersfunction evaluate_template_params_on_jobeg.
514515
private function twig_render_with_seed($text, $seed) {
515516
mt_srand($seed);
516-
$params = [$this->student, $this->quiz];
517+
$params = ['STUDENT' => $this->student, 'QUIZ' => $this->quiz];
517518
return qtype_coderunner_twig::render($text, $params);
518519
}
519520

0 commit comments

Comments
 (0)