WeBWorK Main Forum

Detect Gateway versus regular problem set

Detect Gateway versus regular problem set

by Alex Jordan -
Number of replies: 3
My colleague here has something in his PGcourse.pl that he would like to only apply to problems in regular homework sets, and not when they are part of a Gateway quiz.

Is there a variable that can be used in an if/then statement in PGcourse.pl to only do that thing when the problem is not part of a Gateway set?

I looked through the environment variables in PGinfo's listEnvironmentVariables(), but I don't see smoking gun for whether the problem is coming from a quiz. I do see indirect ways to deduce that, but I'm hoping there is something more direct.
In reply to Alex Jordan

Re: Detect Gateway versus regular problem set

by Dick Lane -
This is an intriguing question --- it provides an opportunity to examine ways in which Gateway items might differ from other problems

In the near-term, I dodge this issue by not loading my PGcourse.pl for some of my problems (short-&-single-answer gateway or minimal-variation tasks, or [mild shudder] a static problem).

Loading a PGgateway.pl file might be a moderate-term alternative, but putting those problems into the OPL would require there to be a no-op version of PGgateway.pl at end of the default load-path.  [That is the case for "PGcourse.pl".]

Returning to Alex's question, I too would like to understand current options for controlling presentation and processing of problems.  Perhaps an expert's response might be "no such option is available now".  With the potential to craft a task for work in a future code-camp, what should Alex/we request?

FWiW: my suggestion for all of the 2014 code-camps is to include Gateway as a key item, especially considering its potential effect upon use of WeBWorK for Placement Testing.
In reply to Alex Jordan

Re: Detect Gateway versus regular problem set

by Alex Jordan -
I think that an indirect way to tell if the problem is being used in a homework set versus gateway quiz might be

defined($envir{QUIZ_PREFIX})

Using PGinfo.pl's listVariables() subroutine and some experimenting, it seems $envir{QUIZ_PREFIX} is defined in Gateway quizzes and not defined in other problem sets. I don't know for sure if this hash value will always behave the way I would expect it to though. I'd prefer to find a way to reference the problem set's type directly: homework, gateway/quiz, or proctored gateway/quiz.
In reply to Alex Jordan

Re: Detect Gateway versus regular problem set

by Gavin LaRose -
Hi all,

I think the best way to do this is to look at the set's type ($set->assignment_type()) and see if it matches /gateway/. If you're looking at the set versions that students are actually working, the set name will have ,vN appended, where N is the version number.

That said, I don't know that the set object is available in the PGcourse file.

Gavin