Skip to content

Commit

Permalink
3.59.0 stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagigas-at-wiris authored Dec 12, 2017
1 parent ff0488c commit 8940a60
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
13 changes: 12 additions & 1 deletion question.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function apply_attempt_state(question_attempt_step $step) {
parent::apply_attempt_state($step);
$this->set_wirisquestioninstance();
$this->load_step($step);
foreach ($this->subquestions as $subquestion) {
if ($subquestion->get_type_name() == 'shortanswerwiris') {
// This is a regrade because is the only case where this function is
// called with the first step instead of start_attempt. So invalidate
// cached matching answers.
$subquestion->step->set_var('_response_hash', '0');
}
}
}

private function set_shortanswer_matching_answers(array $response) {
Expand Down Expand Up @@ -204,7 +212,10 @@ private function set_shortanswer_matching_answers(array $response) {
$substep = $this->get_substep(null, $i);
$subresp = $substep->filter_array($response);
$subresphash = md5($subresp['answer']);
$subquestion->step->set_var('_response_hash', $subresphash, true);
// This is a regrade because is the only case where this function is
// called with the first step instead of start_attempt. So invalidate
// cached matching answers.
$subquestion->step->set_var('_response_hash', '0');
$subquestion->step->set_var('_matching_answer', $matchinganswerid, true);
$numsubq++;
}
Expand Down
4 changes: 2 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function subquestion(question_attempt $qa, question_display_options $opti
}
} else {
foreach ($subq->answers as $ans) {
$size = max($size, core_text::strlen(trim($ans->answer)));
$size = max($size, core_text::strlen(trim($qa->get_question()->expand_variables_text($ans->answer))));
}
}
} else {
Expand All @@ -151,7 +151,7 @@ public function subquestion(question_attempt $qa, question_display_options $opti
}
} else {
foreach ($subq->answers as $ans) {
$size = max($size, textlib::strlen(trim($ans->answer)));
$size = max($size, textlib::strlen(trim($qa->get_question()->expand_variables_text($ans->answer))));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2017112300;
$plugin->release = '3.58.0.1029';
$plugin->version = 2017121200;
$plugin->release = '3.59.0.1031';
$plugin->requires = 2011060313;
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'qtype_multianswerwiris';
$plugin->dependencies = array (
'qtype_wq' => 2017112300
'qtype_wq' => 2017121200
);

0 comments on commit 8940a60

Please sign in to comment.