MDL-56370 mod_feedback: allow to restore values from last attempt

This commit is contained in:
Marina Glancy
2017-04-05 16:08:27 +08:00
parent 3f48012eb5
commit af6a891144
3 changed files with 16 additions and 2 deletions
+15
View File
@@ -401,6 +401,21 @@ class mod_feedback_completion extends mod_feedback_structure {
return $this->completedtmp;
}
/**
* If user has already completed the feedback, create the temproray values from last completed attempt
*
* @return stdClass record from feedback_completedtmp or false if not found
*/
public function create_completed_tmp_from_last_completed() {
if (!$this->get_current_completed_tmp()) {
$lastcompleted = $this->find_last_completed();
if ($lastcompleted) {
$this->completedtmp = feedback_set_tmp_values($lastcompleted);
}
}
return $this->completedtmp;
}
/**
* Saves unfinished response to the temporary table
*