Skip to content
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

make paths relative to notebook_dir for use with jupyterhub #1327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions nbgrader/server_extensions/assignment_list/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down