Conditional activities: Setting default Completion Tracking for activities

Conditional activities: Setting default Completion Tracking for activities

by William Felton -
Number of replies: 10

So I found a solution to a problem I was having and I thought I would post the solution.

I wanted the "Completion Tracking" pulldown to default to "Do not indicate activity completion" so all of my activities and my teacher's activities do not default to having the checkmarks.  The default after my Moodle 2.0 installation was "Students can manually marks the activity as completed", which I didn't want.

Here was my fix:

Modify moodleform_mod.php in moodle/course

Change the following line to the RED code.

$mform->setDefault('completion','$this->_features->defaultcompletion
? COMPLETION_TRACKING_MANUAL
:COMPLETION_TRACKING_NONE);

$mform->setDefault('completion','$this->_features->defaultcompletion
? COMPLETION_TRACKING_NONE
:COMPLETION_TRACKING_MANUAL);

 

I am glad I found this, this is for anyone else out there.

Average of ratings: Useful (1)
In reply to William Felton

Re: Conditional activities: Setting default Completion Tracking for activities

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The even simpler solution is

$mform->setDefault('completion', COMPLETION_TRACKING_NONE);

 

However, as someone who has studied courses that use completion tracking, I would encourage you to re-think. It is really helpful, as a student, to be able to mark things off as you do them. I think your students would like you to leave the default the way it is.

In reply to William Felton

Re: Conditional activities: Setting default Completion Tracking for activities

by Daniel Wright -

Thanks William - we have the same need and this will be handy.  We actually use completion tracking extensively in a corporate training setting, but this is a detail that course authors easily miss when adding resources and activities, and they would prefer that it default to no completion rather than manual.

In reply to William Felton

Re: Conditional activities: Setting default Completion Tracking for activities

by Chris Brainerd -

There is a third method.

1. Mr. Felton's fix modifies the interpretation of what the "Default Completion feature is supported" means. The original code says: if Default Completion is supported by the plugin, then set to Manual Tracking setting by default; if Default Completion is not supported by the plugin, then set to No Tracking setting by default. Although Mr. Felton's fix does achieve what he wants, it has a side-effect of "un-fixing" the opposite: when it actually is supported, it will say None by default.

2. Mr. Hunt's fix is good, but sets everything to None, removing the check for the "Default Completion feature is supported".

3. My fix does not touch standard_coursemodule_elements() but rather init_features(). init_features() is what sets the variable $this->_features->defaultcompletion which is checked in standard_coursemodule_elements(), based on a call to /lib/moodlelib.php: plugin_supports(). In my opinion, it fixes a wrong assumption, and it does so at the root of all related functionality; this is why I favor it.

Original line /course/moodle_form_mod.php:85
$this->_features->defaultcompletion = plugin_supports('mod', $this->_modname, FEATURE_MODEDIT_DEFAULT_COMPLETION, true);

The last parameter in this call to plugin_supports specifies the desired default return value, which plugin_supports chooses when the plugin "does not know or care" (according to the comments). 

I see it as incorrect for this to be true. By default, if plugin does not know or care, it should be false, to disable completion tracking. We desire to ONLY specifically set the completion tracking setting to ANYTHING, in this case ONLY the plugin's default, if it IS specified. The correct parameter is hence false.

Modified line /course/moodle_form_mod.php: 85
$this->_features->defaultcompletion = plugin_supports('mod', $this->_modname, FEATURE_MODEDIT_DEFAULT_COMPLETION, false); 

I also don't see yet a Default Completion Tracking setting in any of the plugin settings, so that means that both as of right now any fix is fine and there is no practical strength to any of these methods, as well as that in the future, which method chosen here may be significant. If suddenly there is a Default Completion Tracking setting on plugins, Mr. Felton's fix will cause opposite behavior, and it will not matter in the case Mr. Hunt's fix; yet- this is a matter for those Moodlers greater than I now that my time is about spent on this one issue- I don't understand: it always sets default to Manual if default completion tracking setting is supported by plugin- so what is the point of the default completion tracking setting? Should it not set the default to whatever the default completion tracking setting is if it is supported?

OK, I probably have at least one hole in logic here, and I write this after Mr. Hunt who has much more street cred than I do around here, but I wanted to voice my alternative.  

In reply to Chris Brainerd

Re: Conditional activities: Setting default Completion Tracking for activities

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That looks like a better solution than mine.

In reply to Chris Brainerd

Re: Conditional activities: Setting default Completion Tracking for activities

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi,

The reason why the 'default completion' feature defaults to true is that for sites which use manual completion tickboxes, pretty much all activities should have completion enabled so that students can tick them. So it would be exceptional to have an 'activity' which normally does not represent something students can do (i.e. Label) and therefore does not get a tickbox by default. Any new activity type, created by somebody who doesn't know about the completion system, should probably default to getting a tickbox because the odds are they're making something or other that students can do.

I think the problem here is that some sites are using completion in a different manner. For example, if you turn on completion but you don't intend to offer student tickboxes, instead only using automatic completion tracking to tick assignments or quizzes they complete, then the defaults are not right for you.

This is a difference based on usage of the system and not a difference based on different activities (i.e. say you stick a Page item in week 6 - the correct behaviour for the 'automatic only' site would be no tickbox, but the correct behaviour for that identical Page in week 6 for a 'power to the students' site would be to have a tickbox).

Consequently if you want to hack it, it doesn't really matter, hack what you like smile The real solution is something more complicated; for example, possibly to change the course-level completion option to actually have several options instead of on/off:

1. Off
2. On (default: grade or manual completion)
3. On (default: only grade completion)

maybe also

4. On (defauilt: grade or on-view completion)

#2 would be same as present except that if an activity normally benefits from grade completion (quiz, assignment), that would be selected by default, instead of the manual one (I think everyone prefers that).

#3 would only default completion on for the grade-completion activities

#4 would be same as #2 except when not using grade completion, it would select automatic 'on-view' completion.

In all cases this would apply to new activities only, you can change them how you like afterward.

Most likely the site level 'enable completion' setting should also be changed/extended so that you can select the default value of THIS option for new courses, because it's likely to reflect sitewide usage practices.

Something like that. This is definitely an improvement that should happen, hopefully I will have time to work on it at some point.

--sam

 

In reply to sam marshall

Re: Conditional activities: Setting default Completion Tracking for activities

by Scott Succow -

Thank you so much for this.  This worked perfectly.  You have saved me much aggravation and time.  I owe you one!

In reply to sam marshall

Re: Conditional activities: Setting default Completion Tracking for activities

by Matt Fedorko -

For me, I want to have it turned off by default because we make extensive use of labels, which would never need to have it turned on, by my accounting ("I just read this sentence, so I'm going to check this box now"?)

I agree that choosing what the default for this on the course, category, or system level would be a dramatic improvement. 

Of course, I feel the same way about many of the settings that I have to futz with every time I make a new course. I would love to have all of the changes I make each time I create a course be the default for a new course (deleting certain blocks, adding others, moving blocks around, changing settings, etc).

Thanks for all of the posts.

In reply to Matt Fedorko

Re: Conditional activities: Setting default Completion Tracking for activities

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

On our courses the main use of labels is things like 'Now read Chapter 4 in the textbook' so it make sense by default. Although I'm sure we also use them for other junk as well.

By the way, when we've checked, our students report that they like the tickboxes smile Even when they don't really do anything. It's nice to keep track of your progress visually. That doesn't mean it's appropriate to have a tickbox on a labels which don't represent activities (like 'Please note, Professor Plum will be away this week' or something), just saying that if there's doubt, it might be best to err on the ticky side.

--sam

In reply to Chris Brainerd

Re: Conditional activities: Setting default Completion Tracking for activities

by Jaswant Tak -

Thank you Chris, how about this


if($this->_modname == 'resource')
            $this->_features->defaultcompletion = plugin_supports('mod', $this->_modname, FEATURE_MODEDIT_DEFAULT_COMPLETION, false);
        else
            $this->_features->defaultcompletion = plugin_supports('mod', $this->_modname, FEATURE_MODEDIT_DEFAULT_COMPLETION, true);


It will show 'Do not indicate activity completion' for all File activity modules, for rest it will work normal.


Thanks

Jaswant

In reply to William Felton

Re: Conditional activities: Setting default Completion Tracking for activities

by Grant Beevers -

Hi William,

I want to set "Students can manually marks the activity as completed"  for every activity in a course post having this not turned on previously. Is there a way I can set these all in one go instead of having to go into each and every activity and setting this parameter?

Thanks in advance,

Grant