Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Course completion

From MoodleDocs

Note: up to date information for users is available in the user documentation on Course completion.

Overview

We need to flag when the "student" has finished a course. :-)

We need to allow several types of criteria to determine how a "student" can complete a course:

  • Manual self completion: A "student" can mark her/himself complete a course.
  • Manual completion by: An "admin", "teacher", "tutor", etc can mark a student complete for a course.
  • Activity completion: A "student" completes an activity, building on Activity Completion developed for 2.0 by Sam Marshall from OU.
  • Course grade: A "student" meets or exceeds a passing grade in the course.
  • Date: After a specified date all "students" are marked as completed in a course.
  • Duration after enrolment: After a specified amount of time after enrolment (e.g., 12 weeks), a "student" is automatically marked as complete in a course.
  • Unenrol: After being unenroled, a "student" is marked complete for the course. Useful for external enrolment plugins.

We need to record when and how a "student" meets each criteria in a course.

We need to regularly aggregate the results for the criteria, measure progress, and check to see if a "student" has completed a course.

We need to show:

  • A "student" the necessary criteria to complete a course
  • A "student" how s/he is progressing in a course along the necessary criteria
  • A "teacher" how his/her students are progressing in a course and which students have completed it

Settings

Site settings

Activity Completion provides an "Enable completion tracking" setting (found in the Site Administration block's Advanced features / optional subsystems settings page) for activity completion. We need to change the setting's name and add another setting for course completion.

Proposed changes:

  • Rename the setting "Enable activity completion tracking" (the setting will continue to allow activity completion to be enabled in all courses)
  • Create a new setting named "Enable course completion tracking" (the setting will allow course completion to be enabled in all courses)

Course settings

Activity Completion provides a fieldset (named "Student progress") which contains a setting (named "Completion tracking") which enables/disables activity completion in a course. We need to rename the setting to describe activity completion and add a setting to enable course completion.

"Enable completion tracking" setting (found in the Site Administration block's Advanced features / optional subsystems settings page) for activity completion.

Proposed changes:

  • Rename the setting "Completion tracking" to "Activity completion tracking" (the setting will continue to make activity completion features available in the courses)
  • Create a new setting named "Course completion tracking" (the setting will make course completion features available in the course)

Course completion settings

When course completion is enabled in a course (see above), a menu item labeled "Completion" will appear in the course Administration block on the main course page. When a user clicks on the "Completion" link, the course completion admin page will display the criteria described below and in the mockup also below:

Edit course completion settings

Criteria enabling

We need to allow criteria to be enabled.

We need some rules about enabled criteria in a course:

  • Each criteria (e.g., "Manual self completion", "Manual completion by", etc) can be enabled
  • By default, all criteria are not enabled

Criteria aggregation

We need to define overall aggregation methods for the criteria type. We also need to a consistent set of aggregation methods for criteria types which have more than one possible option to determine an individual user's course completion:

  • "Manual completion by" // more than one role can be enabled to determine if a student has completed the course
  • "Activity completed" // more than one activity completion can be selected to determine if a student has completed the course

Aggregation methods:

Method Required to complete the criteria type Example Info
All All of the enabled child criteria must be completed Not applicable
Any Any one (1) of the enabled child criteria must be completed Not applicable

Criteria types

Manual self-completion

Action:

Tracked:

  • The day/time when the "student" marked him/herself complete.

Manual completion by

Action:

  • A user assigned to the role in the course will see a checkbox in the Completion progress report, which will allow him/her to manually "Mark complete" each applicable student enrolled in the course.

Tracked:

  • The roleid of the user who marked the "student" complete.
  • The userid of the user who marked the "student" complete.
  • The day/time when the user marked the "student" as complete in the course.

Notes:

  1. The Completion progress report will respect:
    • Separate groups: A "teacher" will only be able to see and mark complete students in her/his group(s) if separate groups is enabled.
    • Role assignments on the USER-level context: A "Tutor" or "Mentor" will only be able to see and mark complete users assigned to him/her.
  2. The criteria can be met only once by the role:
    • If more than one user is assigned to the role and has the capability of marking the user complete
    • After a "student" has been marked complete one time by a user in the role, the Completion progress report will not provide a checkbox in the "Mark complete" column when viewed by any user in the role in the course.
  3. We really be relying on role capabilities and permissions for this.

Activities completed

Action:

  • A "student" will meet the criteria when completing the specified activity, per the activity's 'Activity Completion' settings.

Tracked:

  • The cmid, module type, and activity/resource name for each activity.
  • The day/time when the criteria was detected as complete.

Note:

  1. The list of activities/resources will contain:
    • Each activity/resource in the course with "Completion tracking" enabled within the activity/resource.
    • The type of each activity followed by the activity name (i.e., "[mod name] - [activity/resource name]"). See the mockup on this page (or for a basic example: "Quiz - Derivatives").
  2. If "Activity completion" is not enabled for the site, the "Activities completed" field set will not appear on the page.
  3. If "Activity completion" is enabled for the site and not enabled for the course, the "Activities completed" field set will appear and it will only contain this message:
    "Activity completion must be enabled for this course."
  4. If "Activity completion" is enabled for the site and course, and there are no activities in the course, the "Activities completed" field set will appear and it will only contain this message:
    "Currently, there are no activities in this course"
  5. If "Activity completion" is enabled for the site and course, and there are activities but none have activity completion enabled, the "Activities completed" field set will appear and it will only contain this message:
    "Currently, none of the activities in this course have defined activity completion settings."

Course grade

Action:

  • A "student" will meet the criteria when earning a total course grade above the passing grade.

Tracked:

  • The day/time when the user's course grade was evaluated as having exceeded the passing grade.

Note:

  • The passing grade can also be updated via the course's "Grade to pass" setting found in the Grader report's edit page for the top level category for the course.
  • Once a student has completed the course, both the "Passing grade" setting on the course page and the "Grade to pass" setting in the top level category for the course will be locked. A message about locking will appear on the settings page for the top level category for the course.

Date

Action:

  • A "student" enroled in the course will automatically meet the criteria after a specified date.

Tracked:

  • The day/time when specified day was evaluated as having passed.

Duration after enrolment

Action:

  • A "student" will meet the criteria after the specified number of days after his/her enrolment.

Tracked:

  • The day/time when the "student" marked him/herself complete.

Unenrolment

Action:

  • A "student" will meet the criteria when being unenroled from the course.

Tracked:

  • The day/time when the "student" was unenroled from the course.

Locking

When the first student has completed the course, the course completion criteria settings will be locked. The course settings can be unlocked (via an "Unlock course completion options" button), however a warning message will be displayed stating that unlocking the settings requires deleting all prior course completion data for the course. Once the completion data is deleted, the settings become unlocked (i.e., un-greyed out).

This is consistent with activity completion in 2.0, in which activity completion settings are locked when a user first completes an activity. Activity completion settings can be unlocked after all completion activity is deleted.

Activity settings

If activity completion is enabled and activity completion is a criteria for course completion, then all activity completion settings will be locked once a student has completed the course. In this case, unlocking an activity's completion settings will require deleting both the activity's completion data and the course's completion data.

If an activity is being tracked for course completion, we should add a warning/confirmation screen when an "admin" attempts to delete it. The message should say, "[Activity name] is currently a criteria for course completion. Are you sure you want to delete it?" [Delete anyway] / [Cancel]. If the "admin" confirms, the activity will be deleted however completion data for users who completed it will still remain tracked.

Should the activity completion data remain? Should the course completion data be re-aggregated?

Data structures

Course completion data model

course

The course table will require the following new fields. 'enablecompletion' will now be used for activity and course completion:

Field Type Default Info
completionnotify int(1) Notify users when they complete this course

course_completion_aggr_meth

This new table will be populated with the aggregation method for "Overall criteria", "Manual completion by", and "Activities completed".

Field Type Default Info
id int(10) Auto incrementing
course int(10) The id of the course that the course completion aggregation relates to
criteriatype int(20) null The criteria type's integer constant ('role', 'activity') or null if 'overall' course aggregation.
method int(1) 1 '1'='all', '2'='any', '3'='fraction', '4'='unit'.
value number(10) null null for 'all' and 'any', 0..1 for 'fraction', int > 0 for 'unit'

course_completion_criteria

This new table will be populated with each criteria in each course for course completion:

Field Type Default Info
id int(10) Auto incrementing
course int(10) The id of the course that the course completion criteria relates to
itemname (not implemented) varchar(100) null The name of the item (e.g. "Mark yourself complete", "Teacher marks you complete", "[Activity name]", "[postenrol] days after enrolment", "Official Date: [date]". Used for all item types except unenrol.
criteriatype int(20) The criteria type's integer constant ('self', 'role', 'mod', 'grade', 'enrolperiod', 'date', 'postenrol').
module varchar(100) null The name of the module (e.g., 'scorm', 'quiz', 'feedback'). Used only if criteriatype='mod'.
moduleinstance int(10) null The id of the activity/resource module or role. Used only if criteriatype='mod'.
enrolperiod int(10) null The number of seconds after enrolment. Used only if criteriatype='enrolperiod'.
date int(10) null The timestamp of the date for course completion. Used only if criteriatype='date'.
gradepass number(10) null The course grade required to complete this criteria. Used only if criteriatype='grade'.
role int(10) null The role id that can mark 'student's as complete in the course. Used only if criteriatype='role'.
lock (currently unused) int(10) null Date this criteria was locked

course_completion_crit_compl

This new table will be populated with records for each user as they complete each course completion criteria.

Field Type Default Info
id int(10) Auto incrementing
userid int(10) The id of the user who has completed the course
course int(10) The id of the completed course
criteriaid int(10) The id of the completion criteria this references
gradefinal number(10) null The final grade for the course (if referenced criteria type='grade').
unenroled int(10) null Timestamp when the user was unenroled (if referenced criteria type='unenrol').
deleted (currently unused) int(1) null The course was deleted
timecompleted int(10) null (should be notnull) Timestamp when the user completed the criteria

course_completions

This table records a user's course completion state in a course (but not for individual criteria).

Field Type Default Info
id int(10) Auto incrementing
userid int(10) The id of the user who has completed the course
course int(10) The id of the completed course
timeenrolled int(10) Timestamp when the user was enrolled in the course. In the case of multiple enrollments, the earliest timestamp for a current enrollment is used. If this is reported as 0, the current time is used instead.
timestarted int(10) Timestamp when the user first made progress in the course
timecompleted int(10) null Timestamp when the user completed the course

Evaluating completion

Since the gradebook aggregation is performed via cron, it makes sense that course completion is also evaluated by cron.

This creates an issue in which the progress block will not instantly not show course completion after the necessary criteria has been met by a "student". However, this can be solved by adding some instructional text to say "may take a few minutes to update".

Role capabilities

Feature Description Capability
Progress block Mark self-complete in progress block block/progress:markselfcomplete
Progress report View course progress report coursereport/progress:view
Progress report Mark users complete in course progress report coursereport/progress:markcomplete

Course reporting

Completion progress report

Course completion progress report

A course completion report is available when course completion is enabled.The report can be found via on "Reports" menu item link in the course Administration block and when "Completion tracking" is enabled for the site and course.

The report shows:

  • A column for each of the activities/resources in the course with "Completion tracking" enabled"
  • A row for each user enroled in the course
  • The completion status for each activity

Proposed changes:

  • Include in the report all enabled criteria for course completion (e.g., "Manual self completion", "Manual completion by", as well as the activities etc)
  • Each user's status for completion of each criteria, indicated by a status icon
  • Allow the completion admin page to determine which activities are shown in the report
  • Allow the list of users to be sortable, searchable, and filterable (by group, groupings, and/or user profile fields).
  • Allow user profile fields (standard and custom) can be added/removed as columns in the list.
  • When rolling over the each icon, additional details (including the completion date) will display.

See the mockup to the right with all course completion criteria appearing (i.e., all criteria types have been enabled in a course).

As described further above, display rules for separate groups will apply. If separate groups is enabled for the course, a "teacher" will only see students and completion data for users in the group(s) that she/he is assigned to.

Options for exporting completion data to CSV, ODF or Excel will be available. Completion dates will be included in the export.

A column labeled "Mark complete" will appear containing a checkbox for each student if the user viewing the report is assigned to a role that is allowed to manually indicate that the students have completed the course.

Not shown in the mockup, however we should display the specified values under the applicable heading in the report for each of the following feilds:

  • Period after enrolment
  • Passing grade
  • Date (for completion)

Gradebook

  1. If "Passing grade" is enabled as a criteria for course completion, a grader should have the option of seeing completion status (i.e., "complete" / "not complete") as a column in the grader report.
  2. If a user assigned to a role that is enabled for "Manual completion by", the user should have the option of manually indicating which students have completed the course, a "Mark complete" column will appear to the right of the "Course total" column with a checkbox for each student who has not yet completed the course.

We should also provide an option to show course completion status in gradebook exports. Field options will include:

  • Completion status (e.g., "Complete", "Not complete")
  • Completion date

Completion progress block

Course completion progress block

If completion is enabled for the site and a course, a completion block will be available to be added to the course.

The block will allow a "student" to see:

  • The completion criteria for completing the course
  • His/her status for completion of each criteria (similar to the Completion progress report)
  • His/her overall completion status for the course (complete / not complete)

If all of the enabled criteria are required, the introduction text should say:

"All of the criteria below needed"

If any of the enabled criteria are required, the introduction text should say:

"Any of the criteria below needed"

If the current user can self complete the course, the block will provide an "I've completed this course" button (if the user has not already marked him/herself complete).

Activity completion criteria/status (if enabled for course completion) should be included in the block. See [https://tracker.moodle.org/browse/MDL-16466 MDL-16466] ("Activities on the course page do not convey to student that completion is expected or available for the activity").

User (course) profile

Activity and course completion criteria/status data should appear in a user's "Outline report" and "Complete report" in the user profile area, which is being reworked for 2.0 separately from this spec.

Site reporting

User (site) profile

Mockup of the user profile page with Course completion report

Activity and course completion criteria/status data should appear in a user's profile area.

It would make sense for courses to be grouped by:

  • Courses in progress
  • Courses completed
  • Courses not yet started

For each course, the required criteria and status should appear.


Cron

A cron function will check the criteria and update the course_completion_completions table as necessary. Here's a breakdown of the tasks for each criteria, and will need to be optimised for performance and scalability across all courses:

  • Manual self completion: Cron not needed, performed directly from the Completion progress block.
  • Manual completion by: Cron not needed, performed directly via the Completion progress report.
  • Course grade: Compare the course grade to the passing grade.
  • Unenrol: Compare course_completion->unenroled to role_assignments->timeend for the "student" role in the course.
  • Date: Compare the current date to the specified date.
  • Duration after enrolment: Compare the current date to the role_assignments->timestart + the specified period after enrolment.
  • Activity completion: Evaluate the necessary records in the course_modules_completion table.
  • Course completion: Aggregate the necessary fields in course_completion table, updating the timecompleted field with the current timestamp if the user has met the necessary criteria.

Backup and restore

  • The new completion fields in the course table will be included in the backup.
  • Entries in the course_completion_items, course_completion_aggregation_methods, and course_completion_notify tables for the course should also be included in the backup.
  • When user data is included in a course backup, the backup will also include records in the course_completion_completions table for the course.

Events

The following course completion related events have been added to core:

  • course_completed
    • Triggered when a user completes a course. Event data is the full course_completions database record.
    • Added in version 2.3.2