Deleting an assignment gives an error like:
Alert: Can not find the assignment '/assignment/a/130370e6-a421-4dba-bf32-06df27a38820/78fed328-2108-4ed7-9901-91f67bdf69dd'. Can not find the assignment '/assignment/a/130370e6-a421-4dba-bf32-06df27a38820/78fed328-2108-4ed7-9901-91f67bdf69dd'.
And leaves you on the delete page. The assignment is, however, deleted. A side effect of this bug is that assignments associated with gradebook items will not remove the gradebook item when the assignment is removed. It will leave orphaned gradebook items which cannot be deleted from the Gradebook tool.
The problem is the algorithm responsible for deleting all the data related to an assigment. It ran in the following order:
- delete calendar events associated with the assignment
- delete announcements associated with the assignment
- delete all submissions for the assignment, and the assignment itself
- delete the gradebook item associated with the assignment
However, because the assignment is actually deleted in the 3rd step, when it goes to check if it needs to delete any associated gradebook item(s), the code blows up because the assignment has already been deleted.
The solution is to swap items 3 and 4 so that the gradebook code is executed before the assignment is actually deleted.
A second issue was identified where by if you have an assignment sending grades to the gradebook, and the instructor/maintainer has released at least one grade, the attempt to delete the assignment will fail.
The first time the user confirms to delete, it will appear as if nothing happened, the page refreshes and the user is presented with the confirm deletion message again. The second time, the user will receive an error massage stating that the assignment is being edited by another user:
Someone else is editing this assignment '/assignment/a/729b1df6-de93-4213-bc8c-3c1d1aac5e6f/e58ca9d5-a7e6-47e3-99c5-2c447819d2a5'. Are you sure you want to delete 'delete me' which has submissions already?
However, the real problem is that the edu-services code throws a foreign key constraint violation. The cause of this, is because the code attempts to delete the gradebook item without first removing any comments related to the gradebook item. The solution is to explicitly delete the comments before the gradebook item is deleted.