Missing activity completion option: only via API

Missing activity completion option: only via API

by Halley Media -
Number of replies: 4

Hi there,
I added a new "URL" activity to a topic so that students can view content provided by our remote website. The embedding part is fine as it is: I can configure which parameters will be passed to the URL (such as userid and cmid) and then the content is shown just fine in a iframe. 

Now we need to track activity completion but none of the three existing options are suited to our case.

  • Do not indicate activity completion. Not good because we have to show activity completion;
  • Students can manually mark the activity as completed. Not good because students are not allowed to manually mark activies as completed.
  • Show activity as complete when conditions are met. Not good because then I must select the only condition available, which is "Student must view this activity to complete it". This will mark the activity as complete as soon as the student visits the activity page which is not a true indication of completion, is it?

Instead, our students will have to interact with the remote content provided by our website and it will be us to tell Moodle when completion occurs, by calling the core_completion_override_activity_completion_status function via the REST api. Completion must not be set by any other means.

So, I though a fourth option might be useful.

  • Show activity but only the remote website is allowed to mark completion via API


At present, I'm using a workaround which is far from ideal: I'm using the "Show activity as complete when conditions are met" option and then, as soon as our page is requested, I set the completion status back to 0 by calling the Moodle REST API. When the student has completed the activity, then I finally call it again and set it to 1.

Is there any other workaround (or better solution) I could use in the meantime?
Thanks in advance.

Average of ratings: -
In reply to Halley Media

Re: Missing activity completion option: only via API

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Not that I am aware of. 

Availability conditions are pluggable, so you could write one to do this. 

Examples - https://moodle.org/plugins/browse.php?list=category&id=57

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Missing activity completion option: only via API

by Halley Media -

Nice to know, thanks. Just to be sure: are the "availability conditions" you suggested the same thing as an "activity completion requirement"?

In reply to Halley Media

Re: Missing activity completion option: only via API

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Indeed they are.

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Missing activity completion option: only via API

by Halley Media -

Good, I'll get to work. Thanks for the examples you provided.