Student activity completion
Improving the student activity completion experience | |
---|---|
Project state | In progress |
Tracker issue | MDL-70469 (epic) |
Discussion | Student activity completion in Moodle 3.11 |
Assignee | Team International Legends |
Introduction
For Moodle 3.11 the MUA voted for a project aligned with Moodle's planned UX/UI improvements. Most of the improvements will be released with Moodle 4.0, which is scheduled for November 2021. In collaboration with the MUA, it was agreed there is an opportunity to deliver some UX/UI improvements already for Moodle 3.11.
As a result, the MUA project for Moodle 3.11 will focus on improving the student course experience. In particular, we will focus on making it more obvious to the student what the requirements are to complete each activity, and in doing so making it more obvious what the requirements are to complete the course.
Prototype / mock-ups
The course page
The course page will be enhanced to enable the display of important activity dates and activity completion requirements. The dates will be displayed immediately underneath the activity title. For manual completion, there will be a button as a call to action for the student and for automatic completion the requirements will be displayed in pills.
The activity page
The important activity dates and completion requirements will also be displayed when you are inside an activity.
Course appearance settings
Whether or not the activity dates and completion requirements are displayed within a course and within the activities can be enabled and disabled for each course.
Admin settings
Additionally, there will be a global administrator setting to set the default value for the course settings for displaying activity dates and completion requirements.
Demo site
You are welcome to try things out as a teacher or student on the Student activity completion demo site and share your feedback in the discussion Student activity completion in Moodle 3.11 or in MDL-70469.
User stories
These are the user stories that this project aims to address.
For the student
Student user stories | Acceptance criteria / confirmation |
---|---|
As a student
I want to be able to quickly see on the course page which activities I need to complete so that I know where to focus my attention next |
When I am on the course page I should be able to see the requirements for completing an activity with automatic completion.
When I am on the course page I should be able to manually complete an activity with manual completion. |
As a student
I want to be able to complete an activity from inside the activity so that I don’t need to navigate back to the course page to do so |
When I am on the activity with manual completion’s landing page (e.g. view.php), I should be able to mark the activity as completed in its landing page. |
As a student
I want to be able to clearly see the requirements for an activity with automatic activity completion so that I understand what I need to do to complete it |
When I am on the activity with automatic completion’s landing page (e.g. view.php), I should be able to see the requirements for completing the activity. |
As a student
I want to be able to clearly see the activity dates that are relevant to me so that I can easily plan my schedule in advance |
When I am on the course page, I should be able to see the activity dates that are relevant to me
When I am on the landing page (e.g. view.php) of an activity with dates (e.g. due dates, etc.), I should be able to see these activity dates that are relevant to me. Note: Activity dates relevant to the user cover the following scenarios:
Bottom line is that the activity dates that the students see on their course homepage/activity view page should be consistent with the relevant activity dates that they see on their calendar/timeline. |
For the course creator / teacher
Course creator / teacher user stories | Acceptance criteria / confirmation |
---|---|
As a course creator/editing teacher
I want to be able to configure the course to show completion requirements so that I can decide if I want the completion requirements to be shown |
|
As a course creator/editing teacher
I want to be able to configure the course to show activity dates so that I can decide if I want the activity dates to be shown |
|
For the administrator
Administrator user stories | Acceptance criteria / confirmation |
---|---|
As a site administrator
I want to be able to set the default value for displaying activity completion requirements in the course settings form So that course creators or editing teachers won't have to set its value in each course on course creation |
|
As a site administrator
I want to be able to set the default value for displaying activity dates in the course settings form So that course creators or editing teachers won't have to set its value in each course on course creation |
|
Plugin implementation
Custom activity completion
We have developed a base class for activities that define custom completion rules: \core_completion\activity_custom_completion.
Activity plugins that define custom completion rules must implement a
mod_[modname]\completion\custom_completion
subclass and the following methods:
get_defined_custom_rules()
This is where the plugin's custom completion rules are defined. It basically returns an array of the activity module's custom completion rules.
/**
* Fetch the list of custom completion rules that this module defines.
*
* @return array
*/
public static function get_defined_custom_rules(): array {
return [
'completionsubmit'
];
}
get_state()
This provides the completion state for a given custom completion condition.
/**
* Fetches the completion state for a given completion rule.
*
* @param string $rule The completion rule.
* @return int The completion state.
*/
public function get_state(string $rule): int {
global $DB;
// Make sure to validate the custom completion rule first.
$this->validate_rule($rule);
// Fetch the completion status of the custom completion rule.
$status = COMPLETION_INCOMPLETE;
if ($rule === 'completionsubmit') {
$hassubmission = $DB->record_exists('choice_answers', ['choiceid' => $this->cm->instance, 'userid' => $this->userid]);
$status = $hassubmission ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE;
}
return $status;
}
If your plugin defines custom completion rules, then most likely your plugin implements the
*_get_completion_state()
callback. These callbacks will be deprecated soon in MDL-71144. It will still work in the meantime, but your plugin will not be able to display the individual completion state of your custom completion rules.
get_custom_rule_descriptions()
Returns an associative array with values containing the user-facing textual description of the custom completion rules (which serve as the keys to these values).
/**
* Returns an associative array of the descriptions of custom completion rules.
*
* @return array
*/
public function get_custom_rule_descriptions(): array {
return [
'completionsubmit' => get_string('completiondetail:submit', 'choice')
];
}
get_sort_order()
Returns an array with values containing all of the completion rules applicable to the activity, in the order they should be presented to the user. This must include any custom conditions, as well as any core conditions (eg completionview and/or completionusegrade) that apply to the activity.
/**
* Returns an array of all completion rules, in the order they should be displayed to users.
*
* @return array
*/
public function get_sort_order(): array {
return [
'completionview',
'completionminattempts',
'completionusegrade',
'completionpassorattemptsexhausted',
];
}
Activity dates
Each activity can have milestones, due dates, important dates. We have developed a base class for this: \core\activity_dates.
Activity plugins that define dates must implement a
mod_[modname]\dates
subclass and the following method:
get_dates
This method returns an array of important dates in the following format:
[
[
'label' => <the label>
'timestamp' => <the timestamp>
]
]
This is an example implementation:
/**
* Returns a list of important dates in mod_choice
*
* @return array
*/
protected function get_dates(): array {
$timeopen = $this->cm->customdata['timeopen'] ?? null;
$timeclose = $this->cm->customdata['timeclose'] ?? null;
$now = time();
$dates = [];
if ($timeopen) {
$openlabelid = $timeopen > $now ? 'activitydate:opens' : 'activitydate:opened';
$dates[] = [
'label' => get_string($openlabelid, 'course'),
'timestamp' => (int) $timeopen,
];
}
if ($timeclose) {
$closelabelid = $timeclose > $now ? 'activitydate:closes' : 'activitydate:closed';
$dates[] = [
'label' => get_string($closelabelid, 'course'),
'timestamp' => (int) $timeclose,
];
}
return $dates;
}
The activity information output component
A new output component has been created to display the plugin's custom completion conditions and relevant activity dates to the plugin's view page and the course homepage.
To display the custom completion conditions on your plugin's view.php page, call
$OUTPUT->activity_information()
after the heading of your activity plugin's view.php. For example in mod_choice:
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($choice->name), 2, null);
// Just add this after the heading in view.php. Make sure that $cminfo is a cm_info object. (e.g. by calling cm_info::create())
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id); // Fetch completion information.
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id); // Fetch activity dates.
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);