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() failing to return code feedback #230

Open
garrettgman opened this issue Mar 5, 2021 · 1 comment
Open

grade_this_code() failing to return code feedback #230

garrettgman opened this issue Mar 5, 2021 · 1 comment
Labels
grade code Related to automatic code grading

Comments

@garrettgman
Copy link
Member

garrettgman commented Mar 5, 2021

In the tutorial below, I expected grade_this_code()to add a code suggestion to the incorrect message. Instead, it appears that the incorrect message has supplanted the code suggestion.

  1. I glued the "gradethis.code.feedback" option into the incorrect message to ensure that fail_code_feedback was set to TRUE
  2. If I remove the incorrect argument, the code suggestion reappears in my feedback.
@gadenbuie
Copy link
Member

One (less than ideal) way to accomplish this is to paste a custom message with the default, to create the glue template string (rather than finding the option inside the glue template).

paste("Oops!", getOption("gradethis.code_incorrect"))
#> [1] "Oops! {pipe_warning()}{code_feedback()} {random_encouragement()}"

submission <- list(
  .user_code = "a + b",
  .solution_code = "a + c"
)

grade_this_code(
  incorrect = paste("Oops!", getOption("gradethis.code_incorrect"))
)(submission)
#> <gradethis_graded_this_code: [Incorrect]
#>   Oops! In `a + b`, I expected `c` where you wrote `b`. Please try
#>   again.
#> >

For completeness in the most recent versions of gradethis, gradethis.code_incorrect is the option name (was previously gradethis.code.incorrect).

@gadenbuie gadenbuie added the grade code Related to automatic code grading label Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grade code Related to automatic code grading
Projects
None yet
Development

No branches or pull requests

2 participants