WeBWorK Main Forum

PGML and Show Me Another

PGML and Show Me Another

by Andrew Parker -
Number of replies: 3
Is it possible that Show Me Another fails to recognize different problem text when a problem uses PGML instead of PG?

Because that seems to explain the behavior I'm seeing...

Problems written in PGML all return "WeBWorK was unable to generate a different version of this problem; close this tab, and return to the original problem." when attempting Show Me Another. There is sufficient randomization in these problems, so it's definitely not the case that every PGML problem fails to find alternate versions.

Problems written in PG display new versions of the problem as expected.


In reply to Andrew Parker

Re: PGML and Show Me Another

by Alex Jordan -
Can you post a file that uses PGML that is giving you this behavior?

When SMA was first written, what you are describing would not be the explanation. It was all based on the HTML text that went out at the end of processing, which is going to be different with randomization even when PGML is used. However SMA got a big overhaul at some point and I am unsure if it still works in the same way.
In reply to Alex Jordan

Re: PGML and Show Me Another

by Andrew Parker -
Upon further digging, I've uncovered more details. It is not PG vs PGML after all - it is instead the difference between setting problems to -2 (course default) at the Hmwk Sets Editor level, versus setting them to a specific individual value (>=0).

If a problem is set to SMA = -2 (course default), I am unable to get WeBWorK to generate a new version of the problem - regardless of the value set in the Course Config -> Optional Modules. I can get the SMA button to appear and activate, but the new tab will always say that a new version could not be found.

However, if I change an individual problem from -2 to a value zero or more (at the Hmwk Sets Editor level), a new version is generated without issue when SMA is clicked. Changing the individual problem SMA back to -2 (course default) results in SMA once again failing to find a new version.
In reply to Andrew Parker

Re: PGML and Show Me Another

by Andrew Parker -
I took some time to dig through webwork2/lib/WeBWorK/ContentGenerator/ShowMeAnother.pm

I changed line 91:

active => (!($checkAnswers or $previewAnswers) and $ce->{pg}->{options}->{enableShowMeAnother} and ($problem->{showMeAnother}>-1 or $problem->{showMeAnother}==-2)),
 

which previously didn't recognize $showMeAnother{active} when $problem{showMeAnother} was set to course default by having the value -2.