Skip to content

Commit

Permalink
Update comments/example to reflect debounce default of 1s
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Sep 4, 2024
1 parent 57127c1 commit 44e2105
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# learnr (development version)

- Added a new option, `tutorial.exercise.debounce`, to slow down successive exercise execution. This option should be set to the number of seconds a user will have to wait before their next code execution is performed. (@internaut, #818)
- Added a new option, `tutorial.exercise.debounce`, to slow down successive exercise execution. This option should be set to the number of seconds a user will have to wait before their next code execution is performed. The option defaults to 1 second to deter rapid code executions. To disable this behavior, call `options(tutorial.exercise.debounce = 0)` within your setup chunk. (@internaut, #818)

- Removed dependency on ellipsis (@olivroy, #809)

- Added Norwegian translation contributed by @jonovik. (#806)

# learnr 0.11.5
Expand Down
4 changes: 2 additions & 2 deletions pkgdown/assets/snippets/exercisedebounce.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Set exercise submission debounce time to 1 second
options("tutorial.exercise.debounce" = 1)
# Set exercise submission debounce time to 5 seconds
options("tutorial.exercise.debounce" = 5)
2 changes: 2 additions & 0 deletions pkgdown/assets/snippets/exercisedebounceoff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Disable exercise submission debounce
options("tutorial.exercise.debounce" = 0)
8 changes: 7 additions & 1 deletion vignettes/articles/exercises.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ This option can also be set either globally or per-chunk:
insert_snippet("exerciseeval")
```

It may be necessary to slow down successive exercise submissions, otherwise users may overwhelm your server by running exercise code chunks in fast repetition. You can do so globally by setting the option `tutorial.exercise.debounce` to an amount of time (in seconds) that is waited before the same user's next code execution is performed:
It may be necessary to slow down successive exercise submissions, otherwise users may overwhelm your server by running exercise code chunks in fast repetition. You can do so globally by setting the option `tutorial.exercise.debounce` to an amount of time (in seconds) that is waited before the same user's next code execution is performed. This option is set to 1 second by default.

```{r snippet-exercisedebounce, echo = FALSE}
insert_snippet("exercisedebounce")
```

To disable of this behavior, you can set the option to 0:

```{r snippet-exercisedebounceoff, echo = FALSE}
insert_snippet("exercisedebounceoff")
```

## Exercise Setup {#exercise-setup}

Code chunks with `exercise=TRUE` are evaluated within standalone environments.
Expand Down

0 comments on commit 44e2105

Please sign in to comment.