Skip to content

Backport PR #1675 on branch 0.7.x (Fix view feedback link when root_dir is set) #1676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nbgrader/exchange/default/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ def parse_assignments(self):
info['has_exchange_feedback'] = has_exchange_feedback
info['feedback_updated'] = feedback_updated
if has_local_feedback:
info['local_feedback_path'] = os.path.join(
assignment_dir, 'feedback', info['timestamp'])
full_path_assignment_dir = os.path.abspath(assignment_dir)
if os.path.exists(full_path_assignment_dir):
info['local_feedback_path'] = os.path.join(
full_path_assignment_dir, 'feedback', info['timestamp'])
else:
info['local_feedback_path'] = os.path.join(
assignment_dir, 'feedback', info['timestamp'])
else:
info['local_feedback_path'] = None

Expand Down
8 changes: 8 additions & 0 deletions nbgrader/server_extensions/assignment_list/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ def list_submitted_assignments(self, course_id=None):
}
else:
for assignment in assignments:
for submission in assignment["submissions"]:
if submission['local_feedback_path'] \
and os.path.exists(submission['local_feedback_path']):
submission['local_feedback_path'] = \
os.path.relpath(
submission['local_feedback_path'],
self.parent.notebook_dir
)
assignment["submissions"] = sorted(
assignment["submissions"],
key=lambda x: x["timestamp"])
Expand Down