Skip to content

Commit

Permalink
Merge branch 'master' into polyglot_ui
Browse files Browse the repository at this point in the history
* master:
  Add events to website (#423)
  Add a checker test with error as solution (#422)
  Fixes for learnr on external evaluator (#420)
  Add shinytest support (#407)
  Validate the ability to create an idb store (#417)
  Disable completion of R code inside quotes, closes #401 (#413)
  Bump version (#414)
  Save tutorial output to temp folder when tutorial folder does not have write permissions (#412)
  Throw an informative error if an exercise chunk is NULL (#411)
  Remove outdated exercise option
  Checking for exercise errors (#403)
  Add event handler system (#398)
  External evaluator fixes (#399)
  • Loading branch information
schloerke committed Sep 2, 2020
2 parents bef3d9b + 6de2a01 commit 9420ed7
Show file tree
Hide file tree
Showing 32 changed files with 1,659 additions and 711 deletions.
10 changes: 7 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: learnr
Type: Package
Title: Interactive Tutorials for R
Version: 0.10.1.9004
Version: 0.10.1.9006
Authors@R: c(
person("Barret", "Schloerke", role = c("aut", "cre"), email = "barret@rstudio.com",
comment = c(ORCID = "0000-0001-9986-114X")),
Expand Down Expand Up @@ -38,14 +38,18 @@ Imports:
checkmate,
renv (>= 0.8.0),
curl,
promises
Remotes: rstudio/htmltools
promises,
digest
Remotes:
rstudio/htmltools,
rstudio/shinytest
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Suggests:
testthat (>= 2.1.0),
shinytest (>= 1.4.0.9002),
callr,
rlang,
httpuv,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export(available_tutorials)
export(correct)
export(disable_all_tags)
export(duplicate_env)
export(event_register_handler)
export(external_evaluator)
export(filesystem_storage)
export(incorrect)
export(initialize_tutorial)
export(mark_as)
export(one_time)
export(question)
export(question_checkbox)
export(question_is_correct)
Expand Down
11 changes: 9 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ learnr (development version)
1. `id` - a randombly generated identifier that can be used to align with the associated `exercise_result` event.
2. `time_elapsed` - the time required to run the exercise (in seconds)
3. `timeout_exceeded` - indicates whether the exercise was interrupted due to an exceeded timeout. May be `NA` for some platforms/evaluators if that information is not known or reported. ([#337](https://github.com/rstudio/learnr/pull/337))

* If a `-code-check` chunk returns feedback for an exercise submission, the result of the exercise is no longer displayed for a correct answer (only the feedback is displayed). If both the result and feedback should be displayed, all checking should be performed in a `-check` chunk (i.e., don't provide a `-code-check` chunk). ([#403](https://github.com/rstudio/learnr/pull/403))

## New features

* Introduced "setup chunk chaining", which allows a setup chunk to depend on another setup chunk and so on, forming a chain of setup code that can be used for exercises via `exercise.setup`. Run `run_tutorial("setup-chunks", "learnr")` for a demo. ([#390](https://github.com/rstudio/learnr/pull/390))
* Introduced an [experimental](https://www.tidyverse.org/lifecycle/#experimental) function `external_evaluator()` which can be used to define an exercise evaluator that runs on a remote server and is invoked via HTTP. This allows all exercise execution to be performed outside of the Shiny process hosting the learnr document. ([#345](https://github.com/rstudio/learnr/pull/345), [#354](https://github.com/rstudio/learnr/pull/354))
* For the "forked" evaluator (the default used on Linux), add a limit to the number of forked exercises that learnr will execute in parallel. Previously, this was uncapped, which could cause a learnr process to run out of memory when an influx of traffic arrived. The default limit is 3, but it can be configured using the `tutorial.max.forked.procs` option or the `TUTORIAL_MAX_FORKED_PROCS` environment variable. ([#353](https://github.com/rstudio/learnr/pull/353))
* Added a new `tutorial_options()`, namely `exercise.error.checker`, for customizing feedback when exercise submission code produces an evaluation error. This option accepts a function with the same arguments as `exercise.checker`. Use `gradethis::grade_learnr_error()` for a sensible default for this option. ([#403](https://github.com/rstudio/learnr/pull/403))
* Added an event handler system, with the functions `event_register_handler()` and `one_time()`. There is also a new event `"section_viewed"`, which is triggered when a new section becomes visible. ([#398](https://github.com/rstudio/learnr/pull/398))
* Previously, when a question submission was reset, it would be recorded as a `"question_submission"` event with the value `reset=TRUE`. Now it a separate event, `"reset_question_submission"`. ([#398](https://github.com/rstudio/learnr/pull/398))

## Minor new features and improvements

* Added an `exercise_submitted` event which is fired before evaluating an exercise. This event can be associated with an `exercise_result` event using the randomly generated `id` included in the data of both events. ([#337](https://github.com/rstudio/learnr/pull/337))
* Added a `restore` flag on `exercise_submitted` events which is `TRUE` if the exercise is being restored from a previous execution, or `FALSE` if the exercise is being run interactively.
* Add `label` field to the `exercise_hint` event to identify for which exercise the user requested a hint. ([#377](https://github.com/rstudio/learnr/pull/377))
* Added `include=FALSE` to setup chunks to prevent exercises from printing out messages or potential code output for those setup chunks. ([#390](https://github.com/rstudio/learnr/pull/390))
* Added error handling when user specificies a non-existent label for `exercise.setup` option with an error message. ([#390](https://github.com/rstudio/learnr/pull/390))
* Added error handling when user specifies a non-existent label for `exercise.setup` option with an error message. ([#390](https://github.com/rstudio/learnr/pull/390))
* We no longer forward the checker code to browser (in html), but instead cache it. ([#390](https://github.com/rstudio/learnr/pull/390))
* We no longer display an invisible exercise result warning automatically. Instead, authors must set the exercise chunk option `exercise.warn_invisible = TRUE` to display an invisible result warning message. ([#373](https://github.com/rstudio/learnr/pull/373))

Expand All @@ -30,6 +33,10 @@ learnr (development version)
* Properly enforce time limits and measure exercise execution times that exceed 60 seconds ([#366](https://github.com/rstudio/learnr/pull/366), [#368](https://github.com/rstudio/learnr/pull/368))
* Fixed unexpected behavior for `question_is_correct.learnr_text()` where `trim = FALSE`. Comparisons will now happen with the original input value, not the `HTML()` formatted answer value. ([#376](https://github.com/rstudio/learnr/pull/376))
* Fixed exercise progress spinner being prematurely cleared. ([#384](https://github.com/rstudio/learnr/pull/384))
* Updated `run_tutorial()` to render tutorials in a temp directory if the R user does not have write permissions. ([#347](https://github.com/rstudio/learnr/issues/347))
* An informative error is now thrown when an exercise chunk's body contains nothing, which lets the tutorial author know that something (e.g., empty line(s)) must be present in the chunk body for it to be rendered as an exercise. ([#410](https://github.com/rstudio/learnr/issues/410)) ([#172](https://github.com/rstudio/learnr/issues/172))
* When `exercise.completion=TRUE`, completion is no longer performed inside of quotes. This (intentionally) prevents the student from being able to list files on the R server ([#401](https://github.com/rstudio/learnr/issues/401)).
* Fail gracefully when unable to open an indexedDB store (e.g. in cross-origin iframes in Safari). ([#417](https://github.com/rstudio/learnr/issues/417)).

learnr 0.10.1
===========
Expand Down
10 changes: 5 additions & 5 deletions R/evaluators.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inline_evaluator <- function(expr, timelimit, ...) {
error = function(e) {
# TODO: could grepl the error message to determine if the error was due
# to an exceeded timeout.
error_result(e$message, timeout_exceeded = NA)
exercise_result_error(e$message, timeout_exceeded = NA)
}
)
},
Expand Down Expand Up @@ -111,7 +111,7 @@ setup_forked_evaluator_factory <- function(max_forked_procs){

# check if it's an error and convert it to an html error if it is
if(inherits(result, "try-error"))
result <<- error_result(result, timeout_exceeded = FALSE)
result <<- exercise_result_error(result, timeout_exceeded = FALSE)

TRUE
}
Expand All @@ -126,7 +126,7 @@ setup_forked_evaluator_factory <- function(max_forked_procs){
running_exercises <<- running_exercises - 1

# return error result
result <<- error_result(timeout_error_message(), timeout_exceeded = TRUE)
result <<- exercise_result_timeout()
TRUE
}

Expand Down Expand Up @@ -244,7 +244,7 @@ internal_external_evaluator <- function(

print("Error submitting external exercise:")
print(err)
result <<- error_result("Error submitting external exercise. Please try again later")
result <<- exercise_result_error("Error submitting external exercise. Please try again later")
}

curl::curl_fetch_multi(url, handle = handle, done = done_cb, fail = fail_cb, pool = pool)
Expand Down Expand Up @@ -280,7 +280,7 @@ internal_external_evaluator <- function(
},
onRejected = function(err){
print(err)
result <<- error_result("Error initiating session for external requests. Please try again later")
result <<- exercise_result_error("Error initiating session for external requests. Please try again later")
}
)
},
Expand Down
Loading

0 comments on commit 9420ed7

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy