#' Generate a command for downloading an assessment.
#'
#' This function is useful for extracting files submitted to an `nbgrader` (not
#' `nbsimplegrader`) course. The function will create a script that you can
#' use in a JupyterHub terminal to get all submitted assessments in that course
#' which match the `quiz_name`. This function assumes that each quiz has a
#' single eponymous notebook which is submitted via `nbgrader`. As such the
#' file structure on the JupyterHub and in the downloaded zip will have paths
#' matching: `{course_name}/submitted/*/{quiz_name}/{quiz_name}.ipynb`.
#'
#' @param course_name The name of the nbgrader course.
#' @param quiz_name The name of the assessment and notebook file (omit `.ipynb`).
#' @param file_name The name of the zip file to create.
#'
#' @return A character string of bash script for downloading the notebooks.
#' @export
get_terminal_command <- function(course_name, quiz_name, file_name) {
script <- glue::glue(
'tar -czf {file_name} ',
'{course_name}/submitted/*/{quiz_name}/{quiz_name}.ipynb'
)
if (utils::writeClipboard(script)) {
message(glue::glue(
'\n',
'Script successfully copied to clipboard.',
'1. Open a terminal in the formgrader account',
'2. Paste and run the script',
'3. The zipped will be in the home directory of the account with the name {file_name}',
.sep = '\n'))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.