https://tracker.moodle.org/browse/MDL-64377 introduced the facility for users to completely remove their submission from assignment.
It appears that the checks on whether this is permissable do not take into account the grading status of the submission, nor does it seem to take into account any grading workflow status (such as "in-marking")
Currently the removal of a submission by the submitting user is governed by:
- Them being the owner of the submission
- The submission being editable
In the case (1) the submission has to be "open", which requires:
- Cut off date to not have elapsed
- Submission to be unlocked
- It is after the submissions from date
- If draft mode is enabled Submission to be "submited"
- The submission record is unlocked (in the assignment activity
- Grade for the user is unlocked (in the gradebook)
There is no check in this that relates to the submission actually having been graded.
This leads to a scenario where an assignment with no cut off date and is not using draft mode can have submissions, that have been graded by staff, to be removed by the students.
This obviously leads to potential auditability issues, in that if this is done it is now no longer to show what the grade was made against.
It also does seem to permit the ability for students to change their submission after it was graded (as this also seems to use the submissions_open() function to determine this).
I think that most staff users would expect that upon a grade being awarded for a piece of work that the artefact that was graded would be immmuatable. This would be consistent with the multiple attempts feature which explicitly allows the submision to be kept immutably (at least by the student) alongside the grade awarded.
It would also seem to be burdensome to expect teachers to grade a submission and then manually have to either lock the submission in the activity or (worse as it's "further away") the grade in the gradebook.
I would suggest that there is a fundamental question as to when a student looses the ability to make changes to an assignment submission. There would seem to be a number of options:
- Upon "submission" - this is already handled by the Draft mode
- Upon "cut off date elapsing" - supported already
- Upon being graded - Supported if a further attempt is awarded (i.e. they failed) but otherwise not handled.
- The submission's workflow state being set to "In Marking" (or later).
In addition there is still the scope (tiny race condition) that a student could change their submission whilst a teacher is grading their work, thus theoretically invaliding the grade awarded, so whilst harder to implement, preventing student changes to submissions when starting to grade a submission would be perfect.
This has issues around detecting the starting of grading and, more importantly, detecting if grading is "paused".
Steps to reproduce:
1. Create an assignment with a file submission,without a cut off date, and a due date 5 minutes into the future
2. Login as a student and submit to the assignment before the due date
3. Login as a teacher and grade the assignment.
4. Login as student and review the status of the assignment, submission status should be Graded" and Feedback should display grade.
5. Allow due date to elapse.
Login as student and review the status of the assignment, Submission Status should be "Submitted for grading". Grading status should be Graded" and Feedback should display grade.
6. Edit & Remove Submission button should be visible.
7. Click on "Remove Submission"
8. Confirm submission removal.
9. Submission details have now disappeared (no files) at all are displayed. Submission Status is "Submitted for grading", Grading Status is "Graded".
10. Login as teacher and access assignment
11. Submission no longer displays any submission files that relate to the awarded grade.