Move the WeBWorK::PG module to PG.#1792
Conversation
1849a4f to
dc4bd5d
Compare
drdrew42
left a comment
There was a problem hiding this comment.
Mostly inconsequential feedback from initial code review. Testing forthcoming.
| } elsif ( $item eq 'showMeAnother' ) { | ||
| $showMeAnother = ( $value ) ? $value : 0; | ||
| } elsif ( $item eq 'showHintsAfter' ) { | ||
| $showHintsAfter = ( $value ) ? $value : 0; |
There was a problem hiding this comment.
| $showHintsAfter = ( $value ) ? $value : 0; | |
| $showHintsAfter = ( $value ) ? $value : -2; |
or, more ideally, pull the server default value?
There was a problem hiding this comment.
Now I see, there's a check later that would override with the default value -- but in order for that to occur, the alternate value here must fail the regex /-?\d+/... so empty string?
There was a problem hiding this comment.
Yeah, the logic does seem messed up here. All of the settings here should use the defaults already it seems.
There was a problem hiding this comment.
In fact the later "problem value clean up" won't even occur if these do happen. This is all in a big if .. elsif ... elsif statement.
| $showMeAnother =~ s/[^-?\d-]*//g; | ||
|
|
||
| unless ($showHintsAfter =~ /-?\d+/) {$showHintsAfter = $showMeAnother_default;} | ||
| $showHintsAfter =~ s/[^-?\d-]*//g; |
There was a problem hiding this comment.
| $showHintsAfter =~ s/[^-?\d-]*//g; | |
| $showHintsAfter =~ s/[^-\d]*//g; |
don't allow ? and remove duplicate - (this should happen in all these regex expressions...)
There was a problem hiding this comment.
It looks like there is another issue on line 2182, it should be falling back to $showMeAnother_default and not to $showMeAnother_default.
There was a problem hiding this comment.
You caught me on a cut and paste without real thought on this one.
There was a problem hiding this comment.
Yeah, I am not sure what was intended with the regular expressions including the question mark there. Did some errant values have question marks at some point? It is also debatable if these substitutions are really at all effective in any case. If there is a value that the substitutions actually do something for, that means the administrator has the defaults set to something invalid. In addition this won't fix all bad values. One thing the substitutions wouldn't fix is a value like '5-3'.
There was a problem hiding this comment.
Agreed -- it looks like someone threw [] around the earlier regex... dunno why the - ended up in there a second time. I'd lean towards removing all of these secondary regexes.
| # WARNING: The usage of $self throughout this file is incorrect and quite misleading. In all cases $self needs to at | ||
| # least be a WeBWorK::ContentGenerator object even. In addition it must be ensured that the $self object has the | ||
| # correct hash values to work with the method. |
There was a problem hiding this comment.
| # WARNING: The usage of $self throughout this file is incorrect and quite misleading. In all cases $self needs to at | |
| # least be a WeBWorK::ContentGenerator object even. In addition it must be ensured that the $self object has the | |
| # correct hash values to work with the method. | |
| # WARNING: The usage of $self throughout this file is incorrect and quite misleading. In all cases $self needs to at | |
| # least be a WeBWorK::ContentGenerator object. In addition it must be ensured that the $self object has the | |
| # correct hash values to work with the method. |
Is it worth performing ref($self) =~ /WeBWorK::ContentGenerator/ check in these subroutines? I realize that's not entirely enough... necessary, but not sufficient.
There was a problem hiding this comment.
Perhaps. The old code had comments about what the ref should be, but no actual check. I will leave this for future thought and work. The design of the old ProblemUtil/ProblemUtil.pm module was rather flawed, and this improves things a little, but more needs to be done.
8409960 to
8b6a22a
Compare
6083f3f to
acf5fdc
Compare
|
I tested reduced scoring with gateway quizzes, and things are working correctly with that. I also added a check to ensure that the recorded score is never lowered by webwork regardless of what comes back from PG. |
64ee2a0 to
d9ce8ab
Compare
f132368 to
22d0d48
Compare
990f80e to
d31cff1
Compare
d31cff1 to
038ba92
Compare
Note that the WeBWorK::PG::Local and WeBWorK::PG::Remote modules have been removed. The Local variant is integrated directly into WeBWorK::PG, and the Remote variant was not working and is in disrepair. Remove the pg special environment variables ALWAYS_SHOW_HINT_PERMISSION_LEVEL and ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL. Use the always_show_hint and always_show_solution permissions directly. Whether solutions and hints are shown is now controlled by webwork2 and not by pg. The pg variable/flag $showHint is removed. When and if hints are shown is now controlled by the instructor with a combination of options at the course, set, and problem level. Note that hints were not implemented in gateway quizzes and still aren't. Also the options to use knowls for solutions and hints have been removed. Always use knowls for solutions and hints. Showing the various pieces of debugging information for a problem is now controlled with translation options. Webwork permissions are converted into these debugging options. The VIEW_PROBLEM_DEBUGGING_INFO special pg environment variable was removed and is one of these debugging options. Although the permissionLevel and effectivePermissionLevel are still passed in, they are no longer used by anything in PG. A translator option named isInstructor is passed into the environment that can be set to get instructor things to happen. Another special translator option for scaffolds named forceScaffoldsOpen can be passed to force all scaffolds to be open. This is set in the library browser and in gateway quizzes. Reduced scoring is implemented on the webwork2 side. PG no longer does that. It is implemented with the old method where the reduced score is saved in the problem status and the score before the reduced scoring period begins is saved in the sub_status. This can be changed later to fix some of the other issues with reduced scoring. Several other environment variables that are clearly not needed have also been removed including the appletPath and session key. Note that PGalias no longer uses the course name, user login, set number, and problem number for generating resource UUID's. It now only uses the problem seed, psvn, and problemUUID. So webwork2 constructs a problemUUID that guarantees the necessary uniqueness.
unreduced score in to PG for the recorded score. Otherwise the recorded score can be updated incorrectly. This is determined simply by checking if the sub_status is less that the status in the case that reduced scoring is enabled for the set. Also, a check is added that the score returned by PG (and reduced if reduced scoring is in effect) is less than the currently saved score. If that is the case, the the score in the database is not changed.
038ba92 to
dc4c86a
Compare
Note that the WeBWorK::PG::Local and WeBWorK::PG::Remote modules have been removed. The Local variant is integrated directly into WeBWorK::PG, and the Remote variant was not working and is in disrepair.
Remove the pg special environment variables ALWAYS_SHOW_HINT_PERMISSION_LEVEL and ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL. Use the always_show_hint and always_show_solution permissions directly. Whether solutions and hints are shown is now controlled by webwork2 and not by pg.
The pg variable/flag $showHint is removed. When and if hints are shown is now controlled by the instructor with a combination of options at the course, set, and problem level.
Note that hints were not implemented in gateway quizzes and still aren't.
Also the options to use knowls for solutions and hints have been removed. Always use knowls for solutions and hints.
Showing the various pieces of debugging information for a problem is now controlled with translation options. Webwork permissions are converted into these debugging options. The VIEW_PROBLEM_DEBUGGING_INFO special pg environment variable was removed and is one of these debugging options.
Although the permissionLevel and effectivePermissionLevel are still passed in, they are no longer used by anything in PG. A translator option named isInstructor is passed into the environment that can be set to get instructor things to happen. Another special translator option for scaffolds named forceScaffoldsOpen can be passed to force all scaffolds to be open. This is set in the library browser and in gateway quizzes.
Reduced scoring is implemented on the webwork2 side. PG no longer does that. It is implemented with the old method where the reduced score is saved in the problem status and the score before the reduced scoring period begins is saved in the sub_status. This can be changed later to fix some of the other issues with reduced scoring.
Several other environment variables that are clearly not needed have also been removed including the appletPath and session key.
Note that PGalias no longer uses the course name, user login, set number, and problem number for generating resource UUID's. It now only uses the problem seed, psvn, and problemUUID. So webwork2 constructs a problemUUID that guarantees the necessary uniqueness.
This depends on openwebwork/pg#709.