MDL-30174 Assignment : Only increment submission offset if the current assignment...
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Mon, 7 Nov 2011 17:35:12 +0000 (17:35 +0000)
committerAparup Banerjee <aparup@moodle.com>
Mon, 21 Nov 2011 18:20:16 +0000 (02:20 +0800)
mod/assignment/lib.php

index 86906a9..012b3b3 100644 (file)
@@ -769,8 +769,11 @@ class assignment_base {
                 $offset = required_param('offset', PARAM_INT);
                 $nextid = required_param('nextid', PARAM_INT);
                 $id = required_param('id', PARAM_INT);
                 $offset = required_param('offset', PARAM_INT);
                 $nextid = required_param('nextid', PARAM_INT);
                 $id = required_param('id', PARAM_INT);
-                $offset = (int)$offset+1;
                 $filter = optional_param('filter', self::FILTER_ALL, PARAM_INT);
                 $filter = optional_param('filter', self::FILTER_ALL, PARAM_INT);
+
+                if ($mode == 'next' || $filter !== self::FILTER_REQUIRE_GRADING) {
+                    $offset = (int)$offset+1;
+                }
                 $redirect = new moodle_url('submissions.php',
                         array('id' => $id, 'offset' => $offset, 'userid' => $nextid,
                         'mode' => 'single', 'filter' => $filter));
                 $redirect = new moodle_url('submissions.php',
                         array('id' => $id, 'offset' => $offset, 'userid' => $nextid,
                         'mode' => 'single', 'filter' => $filter));