MDL-58772 mod_feedback: Dont overwrite anonymous entries

The feedback module lets you alternate between responses being anonymised and
not anonymised. When the module is in anonymous mode, its possible for a single
user to make multiple responses.

However when the activity is switched to non-anon mode, if a user leaves a
follow up feedback, one of their previously anonymous responses is used, so
their new response stays anonymous and their old anon response is lost.

This change lets them leave a new non-anonymised feedback entry and retains all
previous anonymous responses instead of incorrectly reusing one of their anon
ones at random.
This commit is contained in:
Adam Olley
2017-05-02 12:49:33 +09:30
parent 06e3b6d8ba
commit 0fb1335924
2 changed files with 56 additions and 1 deletions
+1 -1
View File
@@ -596,7 +596,7 @@ class mod_feedback_completion extends mod_feedback_structure {
// Not possible to retrieve completed anonymous feedback.
return false;
}
$params = array('feedback' => $this->feedback->id, 'userid' => $USER->id);
$params = array('feedback' => $this->feedback->id, 'userid' => $USER->id, 'anonymous_response' => FEEDBACK_ANONYMOUS_NO);
if ($this->get_courseid()) {
$params['courseid'] = $this->get_courseid();
}