Documentation:WeBWorK/How to import homework sets from set-definition files

From UBC Wiki

It is usually easier to upload all HW sets at once and configure all of the HW sets using pre-written definition files. By doing so, the instructors and TAs will not have to change the "parameters" of the incoming HW set every week, such as the start time and the due date of that set. All the parameters can be set automatically using the definition files beforehand. Moreover, if the instructor wants to reuse last term's questions for the same course, all he/she needs to do is slightly modify the definition files.

An example is provided here to illustrate the procedures. Suppose there are two HWsets: HW01 contains three questions: hw01-q1.pg, hw01-q2.pg and hw01-q3.pg; HW02 contains three questions: hw02-q1.pg, hw02-q2.pg and hw02-q3.pg. We now write the definition file for HW01: first create a new text file and copy the following lines of codes into the text file:

setNumber= HW01
openDate = 1/8/17 at 9:00pm
dueDate = 1/17/17 at 9:00pm
answerDate = 1/17/17 at 9:00pm
paperHeaderFile =
screenHeaderFile =
problemList =
HW01/hw01-q1.pg, 1, 2
HW01/hw01-q2.pg, 1, 3
HW01/hw01-q3.pg, 1, 2

Here is the explanation of the above lines:

setNumber = [Name of the homework set]
openDate = [start date of the homework set]
dueDate = [start date of the homework set]
answerDate = [start date of the homework set]
paperHeaderFile = [just keep this empty]
screenHeaderFile = [just keep this empty]
problemList =
[path to problem 1, score, max attempt]
[path to problem 2, score, max attempt]

Save the file as setHW01.txt. After saving it, change the extension from .txt to .def. The final file name will be setHW01.def.

Following the same procedure, it is straightforward to write another definition file for HW02, setHW02.def. Please note that the name of the definition file must begin with "set", for example setHW01.def is a valid name, HW01.def is not valid and will not be recognized by the system.

With two HW sets and two definition files, it is suggested to compress them into a tar.gz file. Follow the procedures below to upload them on WeBWorK:

  1. Log in to your WeBWorK course.
  2. Navigate to File Manager area.
  3. Select the WeBWorK archive (.tgz file) you want to upload.
  4. Leave the settings as default.
  5. Click the Upload button. The archive will be uploaded, unpacked, and the archive file (.tgz) will be deleted on successful unpacking.

Once the uploading procedure is complete, the steps to use the two HW sets are below:

  1. Navigate to Hmwk Sets Editor area.
  2. Select the Import tab.
  3. Choose the set-definition files you'd like to import from.
  4. Optionally, give the two problem sets new names. If you don't enter names, the problem sets will be named after the set-definition files.
  5. Make sure that the settings are what you want and click the blue Take Action! button.

The two problem sets will show up under Homework Sets and the "parameters" of the sets are all set. If you have more than two HW sets, the procedure is pretty much similar to the above.