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).
This commit is contained in:
Damyon Wiese
2015-11-02 16:46:41 +08:00
parent c12979c7df
commit b43abbdccc
+5
View File
@@ -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());