WeBWorK Main Forum

Adding a Course: copying assign/due dates not in .def files

Adding a Course: copying assign/due dates not in .def files

by Kelly Cline -
Number of replies: 5

I want to add a course in such a way that it copies the existing versions of the homework assignments in another course.  In the old course I have edited the assignment/due dates and other information so that they no longer match the information in the .def files.  When I add a course I can copy templates from an existing course, but this does not appear to copy over anything that has been changed outside of the .def files.

Thanks!

--Kelly Cline

In reply to Kelly Cline

Re: Adding a Course: copying assign/due dates not in .def files

by Gavin LaRose -
Hi Kelly,

I think what you've described is exactly the expected behavior: "copying templates" from an old course copies only the files in the templates directory (that is, the set .def files, etc.), not anything from the database. I don't know of any way to transparently copy information from the database into a newly created course.

Gavin
In reply to Kelly Cline

Re: Adding a Course: copying assign/due dates not in .def files

by Danny Glin -
Hi Kelly,
We have similar requirements here at U of C. I'm currently working on building functionality into webwork which allows copying assignments from one course to other courses (within a pre-defined group).
It looks like it would be difficult to use the existing sql code to make this happen, since it has the current course name very deeply entrenched, so my current plan was basically to write an assignment_copy function that looks something like:
assignment_copy($set_id,$dest_course)
which executes a mysql statement something like:
INSERT INTO ${dest_course}_set SELECT * FROM ${current_course}_set WHERE set_id='${set_id}';
I'm curious if anyone has any input as to whether there is a more elegant way to do this. If not, I should be able to post up some code in the next few days.

Cheers,
Danny
In reply to Danny Glin

Re: Adding a Course: copying assign/due dates not in .def files

by Eddie Fuller -
Danny,

It might be reasonable to think about adding a Publish This Set capability to webwork courses. Specifically, on the HW sets editor page, an option could be added that allows one to "publish" the set to a common table that any course could read. The import set feature could then be augmented to read this table so that published sets could be imported in much the same way that .def files lying around in $COURSEID$/templates are.

Either of these seems to be more elegant than my current approach of copying .def files around at the command line, primarily because I'm the one who has to do it for every course :).

-Eddie
In reply to Eddie Fuller

Re: Adding a Course: copying assign/due dates not in .def files

by Davide Cervone -
You could accomplish effectively what you suggest using existing tools without modification to WeBWorK as follows: Make a directory somewhere (that has write access to the web server processes) where the faculty can put their "published" set .def files. Then make symbolic links to this directory in all the course templates directories. (If you make the link in the modelCourse as well, it will be copied to all new courses as they are created). Finally, edit global.conf and add the full path to the shared directory to the $webworkDirs{valid_symlinks} array.

I'd recommend something like "PublicSets" as the name of the directory, and you could use subdirectories (by course, or by topic, for example) where the faculty could put their sets or find those of others. They would have to be a little careful about not overwriting each other's files, but you can work out a naming scheme to help prevent that (say requiring them to use their name as part of the filename). The File manager could be used to move the set .def files (once exported from WeBWorK) into the public area.

Just a suggestion.

Davide
In reply to Davide Cervone

Re: Adding a Course: copying assign/due dates not in .def files

by Danny Glin -
We've used a similar approach to what you suggest in the past. For different webwork courses corresponding to the same class, we've replaced all of the [coursename]/templates directories with symbolic links to the templates directory of the coordinator's webwork course. This way the coordinator could edit a pg file in a single location and all classes would have immediate access to it. It also meant that the prof could create a set in his course, and export it to a .def file, whence it could be immediately imported into other sections without doing any file copying. The problem that arose is that someone still had to go into every other webwork course and import the set. To simplify this, I've created a new Instructor Tool for copying sets from a single course to a predefined group of courses.
Code and a few more details are available at:
http://webworkdev.ucalgary.ca/webworkgroups/
I welcome feedback on whether this is a useful feature to pursue.
Regards,
Danny