Changing feedback that a reviewer worken on is forbidden after set to final
Summary
A reviewer is doing the initial correction for a submission. A tutor now validates this feedback and sets it to final. After submitting he notices he made a mistake and wishes to correct it. The backend will tell him that "Changing final feedback is not allowed."
This is due to
if self._tutor_attempts_to_change_final_feedback_of_reviewer(serializer): # noqa
raise PermissionDenied(
detail="Changing final feedback is not allowed.")
and
def _tutor_attempts_to_change_final_feedback_of_reviewer(self, serializer):
feedback_is_final = serializer.instance.is_final
user_is_tutor = self.request.user.role == models.UserAccount.TUTOR
authors = serializer.instance.of_submission.meta.feedback_authors
set_by_reviewer = authors.filter(
role=models.UserAccount.REVIEWER).exists()
return feedback_is_final and set_by_reviewer and user_is_tutor
the problem is, that it's only checked whether a reviewer is one of the authors and not the last one.
I'm not sure if it's possible to check whether a reviewer is the last person to have worked on a feedback. However, even if possible, i'd argue to drop this constraint altogether, since it causes a confusing distinction between reviewer final and tutor final.
Steps to reproduce
- Reviewer does initial correction
- Tutor does validation, sets final to true
- Tutor wishes to edit feedback
Example Project
What is the current bug behavior?
Tutor gets notification "Changing final feedback is not allowed."
What is the expected correct behavior?
I'd argue to drop the constraint introduced through the _tutor_attempts_to_change_final_feedback_of_reviewer
method. Experience has shown that it is generally better to trust tutors more than to constrain them to much.