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

Allow multiple correct answers for grade_code() #107

Open
garrettgman opened this issue Apr 24, 2020 · 4 comments
Open

Allow multiple correct answers for grade_code() #107

garrettgman opened this issue Apr 24, 2020 · 4 comments
Labels
grade code Related to automatic code grading

Comments

@garrettgman
Copy link
Member

Can a teacher supply multiple equivalent solutions for grade_code() to consider correct?

@schloerke
Copy link
Collaborator

Currently, no

@garrettgman
Copy link
Member Author

I know that :) Mental note: word feature requests better.

But to add something useful to the discussion: a good case for this would be when grading a ggplot2 command. An author might decide that it is permissable to put the aesthetic mappings in ggplot() or the geom function. ...of course the permutations add up to an unmanageable number fairly quickly.

@gadenbuie gadenbuie added the grade code Related to automatic code grading label Jan 11, 2021
@chendaniely
Copy link
Member

Just want to say another good reason for this are when americian vs british spelling will be used in a solution.
Got a message today about using "color" vs "colour" in a ggplot tutorial.

@gadenbuie
Copy link
Member

Just want to say another good reason for this are when americian vs british spelling will be used in a solution.

Rather than having to specify multiple solutions to cover this particular use case, we should be comparing the functions directly. Since scale_color_manual() is an alias for scale_colour_manual() -- meaning they are literally the same function -- code analysis that compares the function itself rather than by name would catch this use case.

library(gradethis)
library(ggplot2)

ex <- mock_this_exercise(
  "scale_color_manual()",
  "scale_colour_manual()"
)

We currently compare the function name...

grade_this_code()(ex)
#> <gradethis_graded_this_code: [Incorrect]
#>   I expected you to call `scale_colour_manual()` where you called
#>   `scale_color_manual()`. That's okay: you learn more from mistakes
#>   than successes. Let's do it one more time.
#> >

where we should compare the function objects directly.

identical(scale_color_manual, scale_colour_manual)
#> [1] TRUE

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

4 participants