Features & Development

WeBWorK + Moodle 3.0

WeBWorK + Moodle 3.0

by Bill Kronholm -
Number of replies: 6
Is there any work underway to support integration of WeBWorK with Moodle 3.0?
In reply to Bill Kronholm

Re: WeBWorK + Moodle 3.0

by Sean Fitzpatrick -
This has been available since at least WeBWorK 2.12; we've been fully integrated with Moodle for over a year.
You need to use LTI authentication; details can be found here:

Once you've done the setup on your server (most of the configuration is in the authen_LTI.conf file) you create a link in Moodle using the external tool. You get automatic account creation and grade passback.
In reply to Bill Kronholm

Re: WeBWorK + Moodle 3.0

by Michael Gage -
wwassignment/wwlink can also be used to integrate webwork and moodle -- but since LTI is a standard that will also connect webwork with other LMS's it is probably the route to follow.

In reply to Michael Gage

Re: WeBWorK + Moodle 3.0

by Sean Fitzpatrick -
We did some experimenting with the different options. LTI is the only one that doesn't require administrative access to Moodle, so if Moodle is deployed campus-wide by a central team (probably in the IT department) there's less coordination involved.

I managed to do some work with our Moodle team. We couldn't get wwassignment to work, probably because they've done a lot of modifications to Moodle to enhance security, balance loads, etc.

We almost got the opaque server up and running, but after a bit of trouble decided that it was unlikely to get used anyway. One still has to create an assignment in WeBWorK, and creating an LTI link is much less work than configuring a Moodle quiz to talk to the opaque server.
In reply to Sean Fitzpatrick

Re: WeBWorK + Moodle 3.0

by Bill Kronholm -
Thanks for the replies. Our Moodle hosting service seemed to think there was no compatibility for Moodle 3.0. (We have just upgraded.)

I will pass this information along to them. I appreciate the help.
In reply to Sean Fitzpatrick

Re: WeBWorK + Moodle 3.0

by Michael Gage -

I agree with your choice and mostly agree with your comments.

The one disagreement is that the opaque server connection doesn't require creating homework assignments in WeBWorK (as LTI and wwassignment do). With opaque the homework/quiz assignments are created using the moodle quiz object -- with each individual question being supplied from the webwork OPL or optionally from a collection of .pg files created locally on the opaque server or stored in the moodle question object. The moodle quiz module provides more, or at least different, flexibility than either the webwork homework assignment or the webwork gateway quiz.

However I agree with the choice of using LTI because in my opinion the opaque server is just barely ready for prime time. It was commissioned by the late Mika Seppala for WEPS (world educational portals)
(now at https://geom.mathstat.helsinki.fi/moodle/) and has received only modest testing. The purpose was to allow STACK and WeBWorK to be used interchangeably as backend engines for evaluating math questions. It works but could still use cosmetic interface improvements.

On the plus side the technology in the opaque server is essentially the same as that which provides rendering for the MathBook_XML (PreTexT) project (http://webwork.maa.org/moodle/mod/forum/discuss.php?d=4194) and was the base on which that engine was built.

My only reservation about LTI vs. wwassignment is the current limitations on the grade data passed back by the interface (just one number per url or "tool").
wwassignment is slightly more flexible. Future versions of LTI should correct this at which point I expect that the rationale for wwassignment will go away.

I run a moodle installation here at the U. of Rochester and use it myself, but it is not widely used by others at the university so I don't get a lot of feedback with respect to the moodle/webwork interoperation, nor am I working with people with extensive moodle expertise. I'd be happy to work with any IT or math people running a production moodle installation about improvements that can/should be made to wwassignment or to the opaque connection.
-- Mike Gage gage@math.rochester.edu

In reply to Bill Kronholm

Re: WeBWorK + Moodle 3.0

by Sean Fitzpatrick -
By the way, here are the settings (i.e. all the ones I might have modified at some point) that are working for us with Moodle 3.3.1:

Basic authentication settings:

$authen{user_module} = [
{ "*" => "WeBWorK::Authen::LTIAdvanced", }, #preferred authorization method
{ "*" => "WeBWorK::Authen::Basic_TheLastOption",} #fallback authorization method

We have external_auth=1 commented out. With these settings, students are forced to log in via Moodle -- in particular they don't have a password, and can't set one, provided that you set:

$permissionLevels{change_password} = "ta";

Next is account creation. Our Moodle deployment includes student email addresses in the class roster, and this was the most convenient means of identifying students. This means we set:

#$preferred_source_of_username = "lis_person_sourcedid";
$preferred_source_of_username = "lis_person_contact_email_primary";

(the first line is commented out since the second is used)

and we want to extract the student login IDs from the email, so we include the line

$strip_address_from_email = 1;

Next, you set the key used to authenticate the handshake between Moodle and WeBWorK (you will need to enter this when you set up the external tool in Moodle):

$LTIBasicConsumerSecret = "******"; #This must be set

Next is the grading setup:

$LTIGradeMode = "course";
#$LTIGradeMode = "homework";

Course mode is less work; you only need to create one link in Moodle. If you want separate gradebook entries for each WeBWorK assignment then switch to homework mode, but you'll need an external tool link for each assignment.

Next you set how often the grades are updated in Moodle:

$LTIGradeOnSubmit = 0;

Setting this to 1 means WeBWorK will call Moodle every time an answer is submitted. Since we can have upwards of 1000 students using it at any one time, we've turned this off to avoid strain on the server. Instead, we use the mass update option:

# The system periodically updates student grades on the LMS. This
# variable controls how often that happens. Set to -1 to disable.

$LTIMassUpdateInterval = 86400; #in seconds

The only other thing you might touch is the conversion of LMS roles to WeBWorK roles, to make sure that whatever roles are defined in Moodle are accounted for.

Don't forget to enable LTI in the local overrides configuration. After that, it's simply a matter of adding an external tool, pointing the URL to your WeBWorK course, and entering the shared secret. (The value of the consumer key doesn't matter.)