Moodle
  1. Moodle
  2. MDL-37804

Student able to submit a file after due date with "Prevent late submissions" turned on

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Create an assignment with a due date and turn "Prevent late submissions" to "Yes" and File uploading set to yes.
      2. As a student, open the newly created assignment and upload a file. Then wait until the submission deadline has passed.
      3. Submit the form by pressing "Save changes".
      4. Verify that the student is unable to submit the assignment and an error message appears.
      Show
      Create an assignment with a due date and turn "Prevent late submissions" to "Yes" and File uploading set to yes. As a student, open the newly created assignment and upload a file. Then wait until the submission deadline has passed. Submit the form by pressing "Save changes". Verify that the student is unable to submit the assignment and an error message appears.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
      git@github.com:recreate/moodle.git
    • Pull Master Branch:

      Description

      I only tested this on Moodle 2.3.3.

      1) Create an assignment with a due date and turn "Prevent late submissions" to "Yes" and File uploading set to yes.

      2) As a student, edit 'Add submission' (or "Edit submission" if you already have one) and choose a file to submit. Keep the page up until after the submission deadline.

      3) After the submission deadline, click "Save changes"

      Expected: Assignment prevented from being submitted

      What actually happens: Assignment submitted and marked as late.

        Gliffy Diagrams

          Activity

          Hide
          Patryk Szuta added a comment -

          Browsing the code, it seems that mod/assign/locallib.php contains a function submissions_open() that checks for whether the submission is open. The function that processes the submission save (process_save_submission()) doesn't call on submissions_open; it only checks to see if the grade in the gradebook is locked.

          Show
          Patryk Szuta added a comment - Browsing the code, it seems that mod/assign/locallib.php contains a function submissions_open() that checks for whether the submission is open. The function that processes the submission save (process_save_submission()) doesn't call on submissions_open; it only checks to see if the grade in the gradebook is locked.
          Hide
          Rex Lorenzo added a comment -

          Just ran into this as well. Running Moodle 2.3.3.

          Show
          Rex Lorenzo added a comment - Just ran into this as well. Running Moodle 2.3.3.
          Hide
          Damyon Wiese added a comment -

          Thanks for reporting this.

          I agree with the code change suggested.

          I've this issue on the backlog.

          Show
          Damyon Wiese added a comment - Thanks for reporting this. I agree with the code change suggested. I've this issue on the backlog.
          Hide
          Damyon Wiese added a comment -

          This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

          For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

          Show
          Damyon Wiese added a comment - This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment
          Hide
          Séverin Terrier added a comment -

          Same problem reported with latest 2.3.7+
          Student can even do "Previous page", delete the file they submited, submit another file and save again. It seems he only needs to first open the submiting page before the closing date...

          Show
          Séverin Terrier added a comment - Same problem reported with latest 2.3.7+ Student can even do "Previous page", delete the file they submited, submit another file and save again. It seems he only needs to first open the submiting page before the closing date...
          Hide
          William Tam added a comment -

          I've made a fix here, https://github.com/recreate/moodle/compare/MDL-37804. I followed what Patryk Szuta wrote above. When the form data is submitted, I check if the submission is still open (which will also check for 'Prevent late submission') and if not, then a notice saying the submission is closed should be displayed.

          Steps to test:

          • Create an assignment with a due date and turn "Prevent late submissions" to "Yes" and File uploading set to yes.
          • As a student, open the newly created assignment and upload a file. Then wait until the submission deadline has passed.
          • Submit the form by pressing "Save changes".
          • Verify that the student is unable to submit the assignment and an error message appears.
          Show
          William Tam added a comment - I've made a fix here, https://github.com/recreate/moodle/compare/MDL-37804 . I followed what Patryk Szuta wrote above. When the form data is submitted, I check if the submission is still open (which will also check for 'Prevent late submission') and if not, then a notice saying the submission is closed should be displayed. Steps to test: Create an assignment with a due date and turn "Prevent late submissions" to "Yes" and File uploading set to yes. As a student, open the newly created assignment and upload a file. Then wait until the submission deadline has passed. Submit the form by pressing "Save changes". Verify that the student is unable to submit the assignment and an error message appears.
          Hide
          Rex Lorenzo added a comment - - edited

          [x] Syntax
          [x] Output
          [x] Whitespace
          [-] Language
          [-] Databases
          [x] Testing
          [x] Security
          [-] Documentation
          [x] Git
          [x] Sanity check

          Passed peer review, requesting push for integration.

          Show
          Rex Lorenzo added a comment - - edited [x] Syntax [x] Output [x] Whitespace [-] Language [-] Databases [x] Testing [x] Security [-] Documentation [x] Git [x] Sanity check Passed peer review, requesting push for integration.
          Hide
          William Tam added a comment -
          Show
          William Tam added a comment - Here are the fixes for 2.3 and 2.4, https://github.com/recreate/moodle/commit/5f11ce035d72f8ccf39fc223f9debedcb6eacc4c https://github.com/recreate/moodle/commit/6eda99ef3caf839318fdc611dc1fbeb749fac5fe It's the same changes as with the master branch.
          Hide
          Séverin Terrier added a comment -

          Where are we with that ? Peer review passed more than one month ago... when integration can happen ?

          Show
          Séverin Terrier added a comment - Where are we with that ? Peer review passed more than one month ago... when integration can happen ?
          Hide
          Damyon Wiese added a comment -

          Thanks +1 from me.

          Submitting for integration.

          Show
          Damyon Wiese added a comment - Thanks +1 from me. Submitting for integration.
          Hide
          Dan Poltawski added a comment -

          Integrated to master, 25 and 24 - thanks guys

          Show
          Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks guys
          Hide
          Petr Skoda added a comment -

          I did not get the error message, I suppose it is because the new code does not get executed at all, see:

                  if (!$this->submissions_open()) {
                      return $this->view_student_error_message();
                  }
                  $instance = $this->get_instance();
           
                  $data = new stdClass();
                  $mform = new mod_assign_submission_form(null, array($this, $data));
                  if ($mform->is_cancelled()) {
                      return true;
                  }
                  if ($data = $mform->get_data()) {
                      if (!$this->submissions_open()) {
                          $notices[] = get_string('duedatereached', 'assign');
                          return false;
                      }
          

          The first !$this->submissions_open() returns from the function before setting the appropriate notice duedatereached.

          Show
          Petr Skoda added a comment - I did not get the error message, I suppose it is because the new code does not get executed at all, see: if (!$this->submissions_open()) { return $this->view_student_error_message(); } $instance = $this->get_instance();   $data = new stdClass(); $mform = new mod_assign_submission_form(null, array($this, $data)); if ($mform->is_cancelled()) { return true; } if ($data = $mform->get_data()) { if (!$this->submissions_open()) { $notices[] = get_string('duedatereached', 'assign'); return false; } The first !$this->submissions_open() returns from the function before setting the appropriate notice duedatereached.
          Hide
          Petr Skoda added a comment -

          I suppose this or MDL-38267 needs to get reverted because both are trying to fix the same thing!

          Show
          Petr Skoda added a comment - I suppose this or MDL-38267 needs to get reverted because both are trying to fix the same thing!
          Hide
          Dan Poltawski added a comment -

          They aren't quite the same thing, but yep.

          Show
          Dan Poltawski added a comment - They aren't quite the same thing, but yep.
          Hide
          Damyon Wiese added a comment -

          From memory they were slightly different and have probably suffered from being both sent for integration at the same time. Looking now.

          Show
          Damyon Wiese added a comment - From memory they were slightly different and have probably suffered from being both sent for integration at the same time. Looking now.
          Hide
          Damyon Wiese added a comment -

          Best result is a combination of the 2,

          Fix available on:
          repo: https://github.com/damyon/moodle.git
          24: MDL-37084-24
          25: MDL-37084-25
          master: MDL-37084-master

          Show
          Damyon Wiese added a comment - Best result is a combination of the 2, Fix available on: repo: https://github.com/damyon/moodle.git 24: MDL-37084 -24 25: MDL-37084 -25 master: MDL-37084 -master
          Hide
          Dan Poltawski added a comment -

          Thanks Damyon.

          Petr - back to you.

          Show
          Dan Poltawski added a comment - Thanks Damyon. Petr - back to you.
          Hide
          Petr Skoda added a comment -

          works now, thanks

          Show
          Petr Skoda added a comment - works now, thanks
          Hide
          Damyon Wiese added a comment -

          This issue along with 77 of it's friends has been sent upstream and released to the world.

          Thankyou for your contribution.

          Show
          Damyon Wiese added a comment - This issue along with 77 of it's friends has been sent upstream and released to the world. Thankyou for your contribution.

            People

            • Votes:
              7 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: