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

grade_this_code() produces error in -code-check (but grade_code() succeeds) #362

Open
gcpoole opened this issue Jan 13, 2024 · 1 comment

Comments

@gcpoole
Copy link

gcpoole commented Jan 13, 2024

The help file for grade_this_code() states the following:

If grade_this_code() is called in a -code-check chunk and returns feedback, either passing or failing feedback, then the user's code is not executed. If you want the user to see the output of their code, call grade_this_code() in the -check chunk.

  • When I call grade_this_code() in a -check chuck, it works as expected when an exercise is submitted.
  • If I change the -check chunk into a -code-check chunk, the tutorial raises an error: "A problem occurred with the grading code for this exercise" when an exercise is submitted.
  • If I change grade_this_code() to grade_code() in the -code-check chunk, everything works as expected when an exercise is submitted, but grade-code() is tagged as superseded by grade_this_code()

learnr: version 0.11.5.9000
gradethis: version 0.2.14

Here is a reproducible example:

---
title: "Reproducible"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
gradethis::gradethis_setup()
```

## Topic 1

Write the R code required to add two plus two:

```{r two-plus-two, exercise=TRUE}

```

```{r two-plus-two-solution}
2+2
```

<!-- The following works fine: note `-check` chunk with `grade_this_code()`

```{r two-plus-two-check}
gradethis::grade_this_code()
```
-->

<!-- The following works fine: note `-code-check` chunk with `grade_code()`

```{r two-plus-two-code-check}
gradethis::grade_code()
```
-->

<!-- the following fails with an error: `-code-check` chunk with `grade_this_code() -->

```{r two-plus-two-code-check}
gradethis::grade_this_code()
```
@gcpoole
Copy link
Author

gcpoole commented Jan 13, 2024

Issue was confirmed on stack overflow prior to report:
https://stackoverflow.com/questions/77809420/bug-gradethisgrade-this-code-fails-in-code-check-chunk

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

No branches or pull requests

1 participant