WeBWorK Problems

Re-ordering problems with unionInclude.pl

Re-ordering problems with unionInclude.pl

by Robin Cruz -
Number of replies: 3

Hi,

Several years ago, I used a technique where a set of problem files were randomly re-ordered. For example, given 3 problems the order of the problems would be different for individual students. This depended on a macro, unionInclude.pl, which seems to be no longer in pg.

I've listed the file I used in the past--which worked until we upgraded to 2.7 this summer--and the error message below. I have an old copy of unionInclude.pl in the macros folder of the course and sometimes it works just fine.

When it does not work, it seems to get stuck on one problem and instead of having problems 3,2,5,1,4 (for example) it will put out 3,2,5,5,5 (with error messages on the problems from file 5). The error message says there is an uninitialized $n. None of the problem files have a variable $n, but unionInclude.pl does.

Is there another way to do this? --rac

-------Error message--------------------------------------------------------------

WeBWorK Warnings

WeBWorK has encountered warnings while processing your request. If this occured when viewing a problem, it was likely caused by an error or ambiguity in that problem. Otherwise, it may indicate a problem with the WeBWorK system itself. If you are a student, report these warnings to your professor to have them corrected. If you are a professor, please consult the warning output below for more information.

Warning messages

  • Use of uninitialized value $n in array element at line 53 of (eval 9960)

----------File to re-order problems---------------------------------------------

DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(
"unionInclude.pl"
);

#--------The first problem number must be initialized.
$initialProblemNumber = 6;

includeRandomProblem(
"31IntAlg_06_LinearSystem.pg",
"31IntAlg_07_LinearSystem.pg",
"31IntAlg_08_LinearSystem.pg",
"31IntAlg_09_LinearSystem.pg",
"31IntAlg_10_LinearSystem.pg",
"31IntAlg_11_LinearSystem.pg",
"31IntAlg_12_LinearSystem.pg",
"31IntAlg_13_LinearSystem.pg"
);
ENDDOCUMENT();


In reply to Robin Cruz

Re: Re-ordering problems with unionInclude.pl

by John Jones -
Hi,

The file unionInclude seems to be in the OPL under both Union and College of Idaho.  It might make sense to make a canonical copy and have only one, but that's another issue.  If you recently upgraded, you may need to tell the config files to use the various OPL macro files.

I know little about this package, but my guess is that your problem has to do with problem duplicates.  Maybe this package doesn't handle includePGproblem which is used to load another pg file (when A.pg is considered a duplicate of B.pg, it is replaced with a file which includes B.pg via includePGproblem).  Some of the files in your list are now pointers to other problems.

You might try replacing the ones which are pointers with the problem they point to, and see if it works then.

John

In reply to John Jones

Re: Re-ordering problems with unionInclude.pl

by Robin Cruz -

Hi, John,

I'm using the unionInclude.pl with problems which are not duplicates. They are not in the OPL. Perhaps I should delete the copy in the course macros folder and use the one in Union's OPL folder (and eventually take the copy out of the College of Idaho macros folder, as well)?

How do I tell the config files to use the OPL macro files?

Thanks -- rac

In reply to Robin Cruz

Re: Re-ordering problems with unionInclude.pl

by John Jones -
Hi Robin,

$pg{directories}{macrosPath} is in default.config and includes most of them by default (I think), and can be set in localOverrides.

John