Skip to content
Snippets Groups Projects
Commit 2169a184 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Explicitly bring context variables to the front of the question variables.

parent 4d43df4a
No related branches found
No related tags found
No related merge requests found
...@@ -423,15 +423,20 @@ class qtype_stack_question extends question_graded_automatically_with_countback ...@@ -423,15 +423,20 @@ class qtype_stack_question extends question_graded_automatically_with_countback
// Set up the context session for this question. // Set up the context session for this question.
$contextsession = array(); $contextsession = array();
$remainder = array();
foreach ($this->session->get_session() as $statement) { foreach ($this->session->get_session() as $statement) {
if (method_exists($statement, 'is_toplevel_property') && $statement->is_toplevel_property('contextvariable')) { if (method_exists($statement, 'is_toplevel_property') &&
$statement->is_toplevel_property('contextvariable')) {
$contextsession[] = $statement; $contextsession[] = $statement;
} else {
$remainder[] = $statement;
} }
} }
$this->contextsession = $contextsession; $this->contextsession = $contextsession;
$this->session = new stack_cas_session2(array_merge($contextsession, $remainder), $this->options, $this->seed);
foreach ($this->prts as $name => $prt) { foreach ($this->prts as $name => $prt) {
$prt->add_contextsession($contextsession); $prt->add_contextsession($prt->add_contextsession);
} }
// Allow inputs to update themselves based on the model answers. // Allow inputs to update themselves based on the model answers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment