-
Bug
-
Resolution: Fixed
-
Minor
-
3.7, 3.8
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_37_STABLE
-
MDL-65886-MOODLE-master -
When removing a submission, the remove() function is called in our file submission plugin in mod/assign/submission/file/locallib.php. (https://github.com/moodle/moodle/blob/master/mod/assign/submission/file/locallib.php#L316)
This remove() function does not change the numfiles field in the mdl_assignsubmission_file table. When we remove a submission, we delete the files, but the numfiles field here stays at 1, and is never reset back to 0.
To see this issue:
- Set up a clean moodle 37 with a test course and enrol a user.
- Create an assignment with 'file' as a submission type, and allow re-attempts.
- As the user, submit a file to the assignment. We now see the state shown in assignment_file_submitted.png and submitted_test_assignment.png
- As the user, click 'remove submission'. The file is removed and we see in the UI removed_submission.png, which shows our file is removed. But in the database, we still have numfiles=1, the same state as shown in assignment_file_submitted.png.
Have noticed this because some plugins look for a numfiles = 1 here to do other submission related tasks, and if the submission is removed but this numfiles stays at 1, we get errors. If we remove a submission and its files, shouldn't the numfiles field should reset to 0 too?
- caused a regression
-
MDL-67294 Choosing bulk removal of empty submissions causes an error
-
- Closed
-