From b43abbdccc60ba91e3ef17885fe5ca4d0718feb5 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 2 Nov 2015 16:41:55 +0800 Subject: [PATCH] MDL-52004 assign: Set unique urls when grading so autosaves work The Atto autosave feature uses the $PAGE->url to generate unique hashes for each page. Assignment uses a MUC cache to persist ordering of lists - the result is that the urls are not unique (they depend on the cached filter). The fix is to spoof a unique url that will grade only that student with no active grading list (no next/prev buttons). --- mod/assign/locallib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index ca80044b73a..cfa27fa5ef7 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2996,6 +2996,11 @@ class assign { if ($rownum == count($useridlist) - 1) { $last = true; } + // This variation on the url will link direct to this student, with no next/previous links. + // The benefit is the url will be the same every time for this student, so Atto autosave drafts can match up. + $returnparams = array('userid' => $userid, 'rownum' => 0, 'useridlistid' => 0); + $this->register_return_link('grade', $returnparams); + $user = $DB->get_record('user', array('id' => $userid)); if ($user) { $viewfullnames = has_capability('moodle/site:viewfullnames', $this->get_course_context());