Skip to content

grade_this_code() failing to return code feedback #230

Open

Description

@garrettgman

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.

Activity

  1. gadenbuie commented on Mar 5, 2021

    @gadenbuie
    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).

  2. added
    grade code
    on Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    grade code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions