Skip to content

Commit d888917

Browse files
foobrichet
foo
authored andcommitted
Set path of feedback directory as relative to root_dir
1 parent fc4b1c5 commit d888917

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

nbgrader/exchange/default/list.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,13 @@ def parse_assignments(self):
172172
info['has_exchange_feedback'] = has_exchange_feedback
173173
info['feedback_updated'] = feedback_updated
174174
if has_local_feedback:
175-
info['local_feedback_path'] = os.path.join(
176-
assignment_dir, 'feedback', info['timestamp'])
175+
full_path_assignment_dir = os.path.abspath(assignment_dir)
176+
if os.path.exists(full_path_assignment_dir):
177+
info['local_feedback_path'] = os.path.join(
178+
full_path_assignment_dir, 'feedback', info['timestamp'])
179+
else:
180+
info['local_feedback_path'] = os.path.join(
181+
assignment_dir, 'feedback', info['timestamp'])
177182
else:
178183
info['local_feedback_path'] = None
179184

nbgrader/server_extensions/assignment_list/handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ def list_submitted_assignments(self, course_id=None):
148148
}
149149
else:
150150
for assignment in assignments:
151+
for submission in assignment["submissions"]:
152+
if 'local_feedback_path' in submission.keys() and \
153+
os.path.exists(submission['local_feedback_path']):
154+
submission['local_feedback_path'] = \
155+
os.path.relpath(submission['local_feedback_path'],
156+
self._root_dir)
151157
assignment["submissions"] = sorted(
152158
assignment["submissions"],
153159
key=lambda x: x["timestamp"])

0 commit comments

Comments
 (0)