Conversation
somiaj
reviewed
Sep 24, 2026
drgrice1
force-pushed
the
use-translator-graders
branch
5 times, most recently
from
September 27, 2026 15:53
15b16d1 to
ad756a6
Compare
pstaabp
approved these changes
Sep 28, 2026
drgrice1
force-pushed
the
use-translator-graders
branch
from
September 28, 2026 11:44
ad756a6 to
ea68712
Compare
…os.pl` versions.
Instead of the `ENDDOCUMENT` method setting the `PROBLEM_GRADER_TO_USE`
flag to the `avg_problem_grader` or `std_problem_grader` methods from
the `PGanswermacros.pl` file (in the case that macro is loaded, or
generally if those methods are defined), the `PROBLEM_GRADER_TO_USE`
environment variable value is simply transferred to the corresponding
flag at that time. Then the code in `WeBWorK::PG` that already exists
for this takes care of choosing the `WeBWorK::PG::Translator` versions
of those methods instead. If the `install_problem_grader` method is
used to set the problem grader to code, that is still used as before.
The `std_problem_grader` code is cleaned up and synchronized in both the
`WeBWorK::PG::Translator` package and in the `PGTanswermacros.pl` file,
although the code in the latter will no longer be used.
The POD for both the `std_problem_grader` and `avg_problem_grader`
methods is also copied into the `WeBWorK::PG::Translator` package.
This is the last thing that is needed to make everything in the
`PGanswermacros.pl` either deprecated or unneeded.
This should work with all existing problems since the methods in the
`PGanswermacros.pl` file and the methods in the `WeBWorK::PG::Translator`
package are functionally the same. Note that those problems that load
the `PGanswermacros.pl` macro (typically via loading `PGstandard.pl`)
and then set the grader via `install_problem_grader(~~&std_problem_grader)`
or `install_problem_grader(~~&avg_problem_grader)` will still be using
the methods from the `PGanswermacros.pl` file.
If instead that macro is NOT loaded, and the grader is set with
`install_problem_grader('std_problem_grader')` or
`install_problem_grader('avg_problem_grader')`, then the
`WeBWorK::PG::Translator` versions will be used. That should be
considered the modern way of doing this. Of course setting the
`avg_problem_grader` is pointless since that is the default. The sample
problems that mention using the `std_problem_grader` have been updated
to use this approach. You should note that this approach of using the
string instead of the method has actually always worked, and is how this
should have been done along. It is much nicer than using the `~~&`
construct.
drgrice1
force-pushed
the
use-translator-graders
branch
from
October 6, 2026 13:23
ea68712 to
8b045b8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of the
ENDDOCUMENTmethod setting thePROBLEM_GRADER_TO_USEflag to theavg_problem_graderorstd_problem_gradermethods from thePGanswermacros.plfile (in the case that macro is loaded, or generally if those methods are defined), thePROBLEM_GRADER_TO_USEenvironment variable value is simply transferred to the corresponding flag at that time. Then the code inWeBWorK::PGthat already exists for this takes care of choosing theWeBWorK::PG::Translatorversions of those methods instead. If theinstall_problem_gradermethod is used to set the problem grader to code, that is still used as before.The
std_problem_gradercode is cleaned up and synchronized in both theWeBWorK::PG::Translatorpackage and in thePGTanswermacros.plfile, although the code in the latter will no longer be used.The POD for both the
std_problem_graderandavg_problem_gradermethods is also copied into theWeBWorK::PG::Translatorpackage.This is the last thing that is needed to make everything in the
PGanswermacros.pleither deprecated or unneeded.This should work with all existing problems since the methods in the
PGanswermacros.plfile and the methods in theWeBWorK::PG::Translatorpackage are functionally the same. Note that those problems that load thePGanswermacros.plmacro (typically via loadingPGstandard.pl) and then set the grader viainstall_problem_grader(~~&std_problem_grader)orinstall_problem_grader(~~&avg_problem_grader)will still be using the methods from thePGanswermacros.plfile.If instead that macro is NOT loaded, and the grader is set with
install_problem_grader('std_problem_grader')orinstall_problem_grader('avg_problem_grader'), then theWeBWorK::PG::Translatorversions will be used. That should be considered the modern way of doing this. Of course setting theavg_problem_graderis pointless since that is the default. The sample problems that mention using thestd_problem_graderhave been updated to use this approach. You should note that this approach of using the string instead of the method has actually always worked, and is how this should have been done along. It is much nicer than using the~~&construct.