Expose attempt number to python custom grader - #18149
Conversation
|
Thanks for the pull request, @jolyonb! I've created OSPR-2391 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here. |
|
jenkins ok to test |
|
jenkins run bokchoy |
|
@edx/educator-all Could you take a look at this? |
|
jenkins run all |
|
@jolyonb in writing tests for this, I may have stumbled onto a bug. Should the "attempt" count still be incremented when the student response raises an error (e.g. when there is a codejail exception)? You can see this manifest in https://build.testeng.edx.org/job/edx-platform-python-unittests-pr/54182/testReport/junit/xmodule.xmodule.tests.test_capa_module/CapaModuleTest/test_submit_problem_error_with_codejail_exception/ |
There was a problem hiding this comment.
This should be 2, not 1. What's happening is that the student is submitting attempt #2, and the grader needs to know that this is attempt number 2, not attempt number 1.
module.attemptspoints to the number of attempts USEDmodule.lcp.context['attempt']points to the attempt number that is ABOUT to be used (or was just ATTEMPTED to be used)
|
@jolyonb tests are passing now, but I'm not convinced I have the correct combination of Can you take a look at the changes in test_capa_module.py and let me know if everything is what you expect? Also, I'm open to suggestions on how to make the comments clearer. |
There was a problem hiding this comment.
This one is just first attempt (not still same)
There was a problem hiding this comment.
@jolyonb Does your comment mean the code comment is confusing?
It's really confusing to me when your PR comment contradicts the code comment you made.
There was a problem hiding this comment.
The comment here is confusing; a complete comment would be "Expect that the number of attempts has incremented from 0 to 1, and that the context believes this was attempt 1". On subsequent grades in this function, a regrade is called, which should not increment the attempt number, and hence the context should still think it's attempt 1.
|
@pdpinch This needs a test to show that the variable is being passed into the check function. I believe this should be put in |
|
jenkins run bokchoy |
|
@mduboseedx this is ready again. We added another test. |
|
@schenedx I believe this is assigned to your team. Could you or someone else give this a review? |
|
Bump... |
e7bfb47 to
ddd8d41
Compare
|
@mduboseedx this is rebased, is passing tests and I give it a 👍. Can I merge it? |
| } | ||
|
|
||
| try: | ||
| self.lcp.context['attempt'] = self.attempts + 1 |
There was a problem hiding this comment.
This is just weird to me. Why do we assign the attempt value to the lcp.context before we updated self.attempts counter on line 1221?
Does self.lcp.grade_answers use this key? if it does, why not just move the self.attempts = self.attempts + 1 line up?
There was a problem hiding this comment.
The whole point of this is to attach the current attempt number to self.lcp.context so that a custom python grader called from self.lcp.grade_answers can access it. Note that if the grader raises an exception (such as unable to parse input etc), the attempt number self.attempts is not incremented. So, on the first attempt, the attempt counter starts at 0, and only increments if a non-exception-raising attempt occurs. However, for the purpose of the grader, that first attempt should be treated as attempt one. Similarly for later attempts.
There was a problem hiding this comment.
@jolyonb I see. Then can you add some comment here to spell out that self.lcp.context['attempt'] is 1 based, but the self.attempts is 0 based? This will help with the person who were as confused as I am.
There was a problem hiding this comment.
@jolyonb Does your comment mean the code comment is confusing?
It's really confusing to me when your PR comment contradicts the code comment you made.
|
Your PR has finished running tests. There were no failures. |
|
@schenedx This has been updated with further comments. |
|
@schenedx Do you think your comments have been addressed? |
|
@jolyonb 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Tuesday, September 11, 2018. |
|
EdX Release Notice: This PR may have caused e2e tests to fail on Stage. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/STAGE_edxapp_M-D |
|
I can't seem to access that link on the E2E test fail? |
|
EdX Release Notice: This PR has been deployed to the production environment. |
This PR exposes a student's attempt number to a python custom grader, so that the custom grader can implement a "diminishing returns" grading policy. The following OLX code for a problem demonstrates how the attempt number can be accessed by the grader.
Special care is taken to pass the correct attempt number through to the grader when performing a regrade.
Mentions: @pdpinch