Skip to content

Commit

Permalink
MDL-52132 core_question: Comment is different if format has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols authored and rezaies committed Jan 15, 2019
1 parent 32636f9 commit 1ed1421
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions question/behaviour/behaviourbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,20 @@ protected function is_same_comment($pendingstep) {
$previouscomment = $this->qa->get_last_behaviour_var('comment');
$newcomment = $pendingstep->get_behaviour_var('comment');

if (is_null($previouscomment) && !html_is_blank($newcomment) ||
$previouscomment != $newcomment) {
if ($previouscomment != $newcomment) {
// The comment has changed.
return false;
}

if (!html_is_blank($newcomment)) {
// Check comment format.
$previouscommentformat = $this->qa->get_last_behaviour_var('commentformat');
$newcommentformat = $pendingstep->get_behaviour_var('commentformat');
if ($previouscommentformat != $newcommentformat) {
return false;
}
}

// So, now we know the comment is the same, so check the mark, if present.
$previousfraction = $this->qa->get_fraction();
$newmark = question_utils::clean_param_mark($pendingstep->get_behaviour_var('mark'));
Expand Down

0 comments on commit 1ed1421

Please sign in to comment.