Skip to content

Commit f76acca

Browse files
brichetmeeseeksmachine
authored andcommitted
Backport PR #1675: Fix view feedback link when root_dir is set
1 parent 1bb3d15 commit f76acca

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
@@ -140,6 +140,12 @@ def list_submitted_assignments(self, course_id=None):
140140
}
141141
else:
142142
for assignment in assignments:
143+
for submission in assignment["submissions"]:
144+
if submission['local_feedback_path'] \
145+
and os.path.exists(submission['local_feedback_path']):
146+
submission['local_feedback_path'] = \
147+
os.path.relpath(submission['local_feedback_path'],
148+
self._root_dir)
143149
assignment["submissions"] = sorted(
144150
assignment["submissions"],
145151
key=lambda x: x["timestamp"])

0 commit comments

Comments
 (0)