MDL-79726 completion: Overall should consider pass/fail states too

In MDL-78744, when the overallcompletion state was added to be displayed
in the activity card, only COMPLETE/INCOMPLETE status were considered.
However, depending on the activity completion settings, there are a
couple of states more that should also be included (COMPLETE_FAIL and
COMPLETE_PASS).

A new method has been added to the cm_completion_details class to
calculate whether a module should be considered or not completed,
based on their completion options and the current value for the
overall complete state.
This commit is contained in:
Sara Arjona
2023-12-01 09:18:36 +01:00
parent abba174fe1
commit 032f39aeef
5 changed files with 239 additions and 3 deletions
@@ -57,6 +57,7 @@ class activity_completion implements renderable, templatable {
global $CFG;
$overallcompletion = $this->cmcompletion->get_overall_completion();
$isoverallcomplete = $this->cmcompletion->is_overall_complete();
$overrideby = $this->get_overrideby();
$course = $this->cminfo->get_course();
@@ -77,8 +78,8 @@ class activity_completion implements renderable, templatable {
'ismanual' => $this->cmcompletion->is_manual(),
'showmanualcompletion' => $this->cmcompletion->show_manual_completion(),
'istrackeduser' => $this->cmcompletion->is_tracked_user(),
'overallcomplete' => $overallcompletion == COMPLETION_COMPLETE,
'overallincomplete' => $overallcompletion == COMPLETION_INCOMPLETE,
'overallcomplete' => $isoverallcomplete,
'overallincomplete' => !$isoverallcomplete,
'withavailability' => $withavailability ?? false,
'overrideby' => $overrideby,
'completiondetails' => $this->get_completion_details($overrideby),