From 0c6d25aaa129c465376b0f680d79771dd69ae8e9 Mon Sep 17 00:00:00 2001 From: Kevin Pinte Date: Thu, 16 Apr 2020 01:13:22 +0200 Subject: [PATCH 1/2] exchange command happen relative to notebook_dir --- .../server_extensions/assignment_list/handlers.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nbgrader/server_extensions/assignment_list/handlers.py b/nbgrader/server_extensions/assignment_list/handlers.py index 0c910b6be..b7420a07d 100644 --- a/nbgrader/server_extensions/assignment_list/handlers.py +++ b/nbgrader/server_extensions/assignment_list/handlers.py @@ -50,15 +50,15 @@ def get_assignment_dir_config(self): with chdir(self.parent.notebook_dir): config = self.load_config() - lister = ExchangeList(config=config) - assignment_dir = lister.assignment_dir + lister = ExchangeList(config=config) + assignment_dir = lister.assignment_dir - # now cd to the full assignment directory and load the config again - with chdir(assignment_dir): + # now cd to the full assignment directory and load the config again + with chdir(assignment_dir): - app = NbGrader() - app.config_file_paths.append(os.getcwd()) - app.load_config_file() + app = NbGrader() + app.config_file_paths.append(os.getcwd()) + app.load_config_file() yield app.config From ea2ec2d90928cf3bc0aab82b36d59c321de5c380 Mon Sep 17 00:00:00 2001 From: Kevin Pinte Date: Thu, 16 Apr 2020 02:03:06 +0200 Subject: [PATCH 2/2] fix path for local feeback link set local_feedback_path to a relative path from the notebook_dir --- nbgrader/server_extensions/assignment_list/handlers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nbgrader/server_extensions/assignment_list/handlers.py b/nbgrader/server_extensions/assignment_list/handlers.py index b7420a07d..18e4dd939 100644 --- a/nbgrader/server_extensions/assignment_list/handlers.py +++ b/nbgrader/server_extensions/assignment_list/handlers.py @@ -143,6 +143,12 @@ def list_submitted_assignments(self, course_id=None): assignment["submissions"] = sorted( assignment["submissions"], key=lambda x: x["timestamp"]) + for submission in assignment["submissions"]: + if submission['has_local_feedback']: + submission['local_feedback_path'] = os.path.relpath(submission['local_feedback_path'], self.parent.notebook_dir) + for notebook in submission['notebooks']: + if notebook['has_local_feedback']: + notebook['local_feedback_path'] = os.path.relpath(notebook['local_feedback_path'], self.parent.notebook_dir) assignments = sorted(assignments, key=lambda x: x["assignment_id"]) retvalue = { "success": True,