As far as I can tell the completion status of any particular user is determined by a cron script (lib/completion/cron.php I guess). This presents a nasty problem.
Unless the cron is running at a ridiculous frequency then the course doesn't actually complete for several minutes after the user completes the final activity. We are getting some very negative feedback about this - it doesn't make sense to the users. They are relieved to have completed their expensive paid-for course and there is no change of status.
Unless I am missing something, and before I put in the bug report, this looks like an unfortunate design decision.
Am I right and any thoughts?
Well, not that I know much about it but yes, I think that is the case - I have been showing people how to type in manually admin/cron.php etc etc which your average user shouldn't really have to do . It should just "happen". I think there are a number of mentions of it already in the tracker - MDL-27368
Just a thought: does that /lib/completion/cron.php run on its own, or does it rely on other includes in the main /admin/cli/cron.php (e.g. 'config.php')?
Although it's far from ideal, you could run just the completion cron script more frequently than the regular cron script.
I totally agree that, in an ideal world, the course would be marked as 'complete' as soon as a user completes the last task (e.g. when they call 'view.php' or '/my' after completing the last task). This is a far better architectural decision than constantly polling via the cron script.
Just out of interest, how often do you run the main cron script over at .gla? Barring any constant factors (such as syncing enrolments from an external MySQL database), is it simply a case of 'the more often it runs, the less it has to process each time'?
Nothing to do with GLA (still locked into 1.9 land). This was actually a supported Moodle 2 site, but I can see the problem coming over the hill with other sites that use this feature (or are about to).
On that site the cron was run every 30 minutes, which is normally perfectly fine but is useless for completion.
That was our workaround... we wrote a wrapper around that and call it much more frequently. That's not a solution though. That's even more inefficient than running the process from 'inside' Moodle at appropriate points. Have you looked at the scary SQL statements in that cron script? I haven't done any measuring but it doesn't fill me with a warm feeling
Drupal comes with a "Poormanscron" feature (http://drupal.org/project/poormanscron ):
I don't know whether a similar mechanism would be feasible for Moodle too. Perhaps it could be implemented only for relevant modules instead of site wide.
Couldn't agree more, Howard. We use Moodle (2.0.2) in a corporate training environment and this is a very big deal for us as well. In our case, students must complete various types of mandatory training and they get very frustrated when it's not immediately clear that they have completed the course requirements.
Some other things that would really enhance this would be a completion status next to courses on the MyMoodle page, a very clear way to indicate why a course is still in an incomplete status, and a notification trigger (email, etc.) on course completion.
Btw, we have created a very simple mod to show course completion status on the MyMoodle page. We're now working on displaying the details of completion status using the code from the core Course Completion block. The standard code doesn't adequately handle certain quiz scenarios, e.g. the user has attempted the maximum number of attempts on the quiz but has failed to achieve a passing grade.
I would also love to see the Certificate module be able to automatically email a certificate to the student on course completion rather than forcing the Student to generate one via a course activity.
I know that 2.x is still relatively young, so I am hoping that some of these things will make it into future releases.
Original developer of Course Completion here! Trying to catch up on a big back log of posts/requests!
Yes, there were a few mistakes in the original design of Course Completion. Putting it in the cron was definately one of these, another was basing the code off gradebook's grade_object (called data_object in Course Completion).
Some things are dependant on the cron (e.g. duration, date criteria) but the aim is to eventually remove the main completion loop and make it run when any of a user's status in a criteria changes.
The interim solution (which I have some patches that work towards) is to make the user profile reports and completion status block display the user's calculated state (which will be up to date), and leave the cron to update the database later on. This means the only part of the site that will lag is the course report, and any custom code dependant on the cron.
Btw Daniel, I believe the Quiz issues you are having relate more to Acitivity Completion, which is in essence a far different system (of which Sam Marshall is the maintainer).
Hope this helps,
Thanks very much for the note Aaron. Please know that I have great appreciation and admiration for individuals like yourself who work very hard to make Moodle an excellent system.
Where can I find your patches? I'm sure those will be helpful.
As for the quiz scenarios, these may certainly arise from the way that the Activity Completion is constructed and reports to Course Completion. Would you mind taking a look at my post here to see if you have any idea why the two elements of course completion are reporting different results?
If the issue is with activity completion, then the main point of confusion would be caused by the main course screen. I would suggest that an interim solution might consist of looping through the course activity modules and updating their completion status using the funcitons available in the completion library. If that doesn't yield the result you want, you might need to look into the scripts that are run during the cron job.
An extra datum in a block, telling someone they have completed an activity while it is marked otherwise on the course page, will be baffling, especially if students are debarred from taking the following activities. If I know that my phone gives me the wrong time, I'd rather fix my phone's clock than buy an accurate watch!
I guess you might have a small performance hit by running these functions every time a course page loads, and (following my suggestion) you would be adding some more non-modular code to your set-up so it comes down to what's important to you.
*Course* completion might be a different issue, but there must also be a script that you would always expect to be run immediately prior to users seeing the results of course completion (a funnel point). So if whatever completes the completion does it completely in cron, you can make the same calls within that script and that should give your users the undeferred pleasure of seeing the end result of their work (with the above provisos).
I also think that its important to make the system responsive to people's progress through their courses, if this is being tracked.
I have a related question that might be affected by the 30-minute delay that the cron creates. Is it possible to do a course completion upon launch in Moodle? That is, a course registers as complete as soon as a user opens it. Thanks for your help.
Unfortunately whatever way you trigger the course to be marked as complete will require the cron job to run to complete the process. This is something I am working on but it is still a while off.
Hope that helps,