From be97e17c4453b66d3dfa8abc8c8fe4dc1dc42968 Mon Sep 17 00:00:00 2001 From: Frans Welin <73482123+franswel@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:22:24 +0300 Subject: [PATCH] fix an issue in release_feedback where groupshared user could not re-release feedback (#1667) Co-authored-by: Frans Welin --- nbgrader/exchange/default/release_feedback.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nbgrader/exchange/default/release_feedback.py b/nbgrader/exchange/default/release_feedback.py index 00dd05687..b9370f550 100644 --- a/nbgrader/exchange/default/release_feedback.py +++ b/nbgrader/exchange/default/release_feedback.py @@ -67,9 +67,12 @@ def copy_files(self): submission_secret = fh.read() checksum = notebook_hash(secret=submission_secret, notebook_id=notebook_id) - dest = os.path.join(self.dest_path, "{}.html".format(checksum)) + dest = os.path.join(self.dest_path, "{}-tmp.html".format(checksum)) self.log.info("Releasing feedback for student '{}' on assignment '{}/{}/{}' ({})".format( student_id, self.coursedir.course_id, self.coursedir.assignment_id, notebook_id, timestamp)) shutil.copy(html_file, dest) + # Copy to temporary location and mv to update atomically. + updated_feedback = os.path.join(self.dest_path, "{}.html". format(checksum)) + shutil.move(dest, updated_feedback) self.log.info("Feedback released to: {}".format(dest))