-
-
Notifications
You must be signed in to change notification settings - Fork 81
Update to Reaction context #1315
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
base: develop
Are you sure you want to change the base?
Conversation
…sion to molecular form, and allow comparisons based on molecular forms, better handling of charges
The following warning appears when running the MWE given in openwebwork/mathquill#41: Argument "type" isn't numeric in subtraction (-) at line 874 of [PG]/macros/contexts/contextReaction.pl Without sinking into the code, this warning can be suppressed if "$other -type" in line 874 is changed to "$other ->type". |
Thanks @sfiedle1, I'm not sure how that got messed up. I've added a commit to fix it. |
correct answer in the form the correct answer is given (molecular or | ||
condensed structural form). If you want to allow either form, then | ||
you can set the flag C<acceptMolecularForm> to C<1>, in which case, | ||
the student's answwer is compared first to the original correct answer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: answwer => answer
$R = Compute("CH_3CH_2CH_3")->molecularForm; | ||
would make C<$R> be the quivalent of C<Compute("C_3H_8")>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quivalent => equivalent
you can set the flag C<acceptMolecularForm> to C<1>, in which case, | ||
the student's answwer is compared first to the original correct answer | ||
and then to its molecular form. For example, if the correct answer is | ||
`(NH_4)_3PO_4`, then a student answer of `N_3H_12PO_4` would also be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you fell into markdown mode here! This should probably be
`(NH_4)_3PO_4`, then a student answer of `N_3H_12PO_4` would also be | |
C<(NH_4)_3PO_4>, then a student answer of C<N_3H_12PO_4> would also be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me. I tested to see that this fixes the issue that @sfiedle1 posted to the openwebwork/mathquill repository, but I don't have enough chemistry knowledge to really test the other changes.
This is a PR that includes a bunch of new features that I had in the wings but was waiting for some feedback from the folks I made the changes for (which never came). In light of openwebwork/mathquill#41, I thought I'd fix that problem, and include these other changes as well.
The changes here are to:
See the changes to the comments (in particular the new large section on molecular form). There are a bunch of new flags to control how the checking is performed.
The new section in the
Close()
method of thecontext::Reaction
package is the part that fixes the parentheses around charges.Some methods that are common to multiple objects have been moved into a new
context::Reaction::common
package, and there is new data stored about the elements in a compound that is used to manage the molecular form. Most of the rest is new methods used for computing the molecular forms.