Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60973

Activity completion defaults are implemented differently in two places



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4
    • Fix Version/s: None
    • Component/s: Activity completion
    • Labels:
    • Affected Branches:


      When creating a new module, there are two types of defaults for activity completion:

      DEFAULT 1 (moodleform_mod.php line 651):
      If the 'completiondefault' config option is set, and the module sets the 'defaultcompletion' feature, then the completion dropdown will be set to 'Automatic' provided the activity has either custom completion rules, or tracks views. If it doesn't have rules/views then the dropdown will be set to 'Manual'. If it doesn't have the feature, or the config option is unset, then the dropdown will be set to 'None'.

      DEFAULT 2 (course/modlib.php prepare_new_moduleinfo_data(), line 746):
      If there is an entry in course_completion_defaults for the module, it uses those settings. Otherwise it does logic quite similar to DEFAULT 1 except that it never sets automatic completion, only manual.

      The system behaviour means that the code in DEFAULT 2 is always used - it looks like this was added in 3.2, so probably since then. The code in DEFAULT 1, though still present, is never actually used because the data is always set in the form.

      Conclusion: To maintain current (since 3.2) behaviour and avoid confusion with code that is unused, the code about this in moodleform_mod should be removed. However, somebody might like to think about whether the behaviour about defaulting to automatic (if available), from that code, is appropriate. If so it should be moved into the newer code.

      Original description:

      A "standard_coursemodule_elements" function generate course activity setting form including "completion". In this function set completion tracking configuration's default selection, but "$mform->set_data($data)" override this configuration without any check.

      I think "standard_coursemodule_elements" function should be called in "get_moduleinfo_data".

      related post: https://moodle.org/mod/forum/discuss.php?d=362529.




            • Assignee:
              papillon326 Mitsuru Udagawa
              Component watchers:
              Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: