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

'Empty' exercise chunks aren't treated as exercises #410

Closed
cpsievert opened this issue Jul 29, 2020 · 1 comment · Fixed by #411
Closed

'Empty' exercise chunks aren't treated as exercises #410

cpsievert opened this issue Jul 29, 2020 · 1 comment · Fixed by #411
Assignees
Milestone

Comments

@cpsievert
Copy link
Contributor

cpsievert commented Jul 29, 2020

Running the tutorial below yields a misleading error of:

Error in is_code_identical(user, solution) : 
  No solution is provided for this exercise.

This is because the foo chunk isn't being treated as an exercise, so the foo-check is being evaluated outside of a grade_learnr() context. Adding an empty line to the foo chunk fixes the problem, but either a more informative error should be thrown, or it should "just work"

---
title: "Issue #410"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(learnr)
library(gradethis)
tutorial_options(exercise.checker = grade_learnr)
knitr::opts_chunk$set(echo = FALSE)
```

## Minimal example

This chunk isn't treated as an exercise!

```{r foo, exercise = TRUE}
```

```{r foo-solution}
sum(1)
```

```{r foo-check}
grade_code()
```
@KatherineCox
Copy link

Is this related to #172 ?

cpsievert added a commit that referenced this issue Jul 30, 2020
* Throw an informative error if an exercise chunk is NULL, closes #410

* update news
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants