Skip to content

Commit

Permalink
Merge pull request #22 from ucbds-infra/force-save
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispyles authored Feb 1, 2024
2 parents 6106d40 + 0b91607 commit 1ff7e78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Updated `ottr::export` so that notebook PDF generation failures do not prevent zip file creation [#766](https://github.com/ucbds-infra/otter-grader/issues/766)
* Added the `debug` argument to `ottr::export` to assist in debugging PDF generation failures
* Updated `ottr::export` force-save functionality to rely on [`ottr_force_save_labextension`](https://github.com/chrispyles/ottr-force-save-labextension) per [#767](https://github.com/ucbds-infra/otter-grader/issues/767)

**v1.4.0:**

Expand Down
6 changes: 4 additions & 2 deletions R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ ext <- tools::file_ext(submission_path)
success <- save_notebook(submission_path)
if (!success) {
warning(paste0(
"Couldn't automatically save the notebook; we recommend using File > Save & ",
"Checkpoint and then re-running this cell. The zip file returned by this call ",
"Couldn't automatically save the notebook; ensure that you have ",
"ottr_force_save_labextension installed. If you have it installed and this issue keeps",
"reoccurring, you should use File > Save & ",
"Checkpoint and then rerun this cell. The zip file generated by this call ",
"will use the last saved version of this notebook."
))
}
Expand Down
5 changes: 2 additions & 3 deletions R/save_notebook.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ save_notebook <- function(nb_path, timeout = 10) {
IRdisplay::display_javascript("
if (typeof Jupyter !== 'undefined') {
Jupyter.notebook.save_checkpoint();
}
else {
document.querySelector('[data-command=\"docmanager:save\"]').click();
} else if ('__ottr_force_save_labextension_force_save' in window) {
window.__ottr_force_save_labextension_force_save();
}
")

Expand Down

0 comments on commit 1ff7e78

Please sign in to comment.