Wrong completion tracking alert banner shows in edit mode

Issue #148 resolved
Ben Wu created an issue

Plugin Version: 4.0.0.8 Beta and 4.0.0.9 RC

Environment: Moodle 4.0.5 and 4.1.1

Problem Summary: Moodle courses with Completion Tracking disabled are showing "You have completion tracking switched on at the course level, but at the individual activity level, no items have tracking enabled, so there is nothing to track. Change in bulk" in Edit Mode, which is wrong. If clicking on Change in Bulk URL, users will be directed to the Course Completion page and make changes.

This issue is observed in Moodle 4.1.1 and 4.0.5 with Tiles Format Plugin 4.0.0.8 Beta and 4.0.0.9RC installed.

How to replicate:

  1. In moodle, ensure Completion Tracking is enabled in Site Administration.
  2. Create a new Tiles format course.
  3. Ensure it has at least 1 activity.
  4. Ensure its completion tracking is disabled.
  5. Go to the course page and turn on edit mode. The alert should appear.

Comments (5)

  1. Mirko Otto

    The Moodle Tiles format plugin does not check if completion tracking 'enablecompletion' is enabled in the course. The query should be made in the file

    classes/output/courseformat/content.php
    

    The Git diff is

    diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php
    index 674f9a5..168d5c5 100644
    --- a/classes/output/courseformat/content.php
    +++ b/classes/output/courseformat/content.php
    @@ -68,7 +68,8 @@ class content extends content_base {
                     ];
                 }
                 // If completion tracking is on but nothing to track at activity level, display help to teacher.
    -            $hasnotrackableactivities = $DB->record_exists('course_modules', ['course' => $course->id, 'visible' => 1])
    +           $hasnotrackableactivities = $DB->record_exists('course', ['id' => $course->id, 'enablecompletion' => 1])
    +               && $DB->record_exists('course_modules', ['course' => $course->id, 'visible' => 1])
                     && !$DB->record_exists_sql(
                     "SELECT id FROM {course_modules} WHERE course = ? AND visible = 1 AND completion != 0",
                     [$course->id]
    

  2. Ben Wu reporter

    Hi Mirko,

    Thank you! It looks like a promising solution to me. I’m not sure if you want to submit a pull request. It would certainly be a big help to the Tile Format users.

    Ben

  3. David Watson repo owner

    Thanks Ben for the report and Mirko for the investigation / PR. I have put something in the next release.

  4. Log in to comment