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
Patch answer hash #220
Patch answer hash #220
Conversation
…o they don't cause problems outside the safe compartment. Call this method from the PG::Translator->grade_problem().
I'm testing this with a variety of problems. I get the error
with the problem (edited)
P.S. All of my other checks, including the tests above, went ok. |
The problem is invalid. I think I mentioned this to you last time you sent me this problem, but when you do
you are not creating a new MathObject, but are simply copying the reference to the object. That means $N and $M now point to the same matrix. So when you use You might be able to use
to get a second copy. See if that works better. If you still get the error, I'll look into it further. |
Ah, yeah, thanks for reminding me about that. It still fails, even after |
OK I'll check further. |
OK, I've changed the code to only call Note that the problem you have listed above is still invalid. First, it is missing the So you either need to use two separate Matrix objects, or you need to make a copy of the first one as I suggested above. Using the same matrix object for two separate answer arrays will lead to problems. |
Patch answer hash That works for me. I'll fix the problem for future tests.
This implements two features:
stringify_hash()
method of the AnswerHash, which is called by the newstringify_answers()
method inPG::Translate
, which is called by the existinggrade_problem()
method.To test (1), you can use
in a problem. This should display an answer rule followed by "AnswerEvaluator" in the patched code, and "CODE(...)" in the unpatched code.
For (2), you can't really test this from inside the problem, since the change isn't made until after the grading is over. But you can test the
stringify_hash()
method usingThis should show "scalar" in all entries of the right-hand column. Commenting out the
$ans->stringify_hash;
call should include several Value::Formula entries in the right-hand column.If you want to test this more completely, you would need to print something from within the code that called
PG::Translator->grade_problem
to check that the answer hashes are now stringified.