Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.3, 2.4
    • Fix Version/s: 2.3.2
    • Component/s: Course completion
    • Labels:
    • Testing Instructions:
      Hide

      NOTE: Will require developer to test.

      Write some code to react to the "course_completed" event, or even just add a breakpoint in events_trigger();

      Trigger a course completion:
      1) Enable Course completion in advanced settings
      2) Create course with completion enabled
      3) Tick "Self Completion" criteria on Completion tracking page
      4) Add "Self completion" block to course page
      5) Enrol user in course, login as user, complete course view the Self completion block
      6) Run cron (course_completed event should trigger from the cron)

      Event data supplied in event should match the corresponding record in the course_completions table.

      Show
      NOTE: Will require developer to test. Write some code to react to the "course_completed" event, or even just add a breakpoint in events_trigger(); Trigger a course completion: 1) Enable Course completion in advanced settings 2) Create course with completion enabled 3) Tick "Self Completion" criteria on Completion tracking page 4) Add "Self completion" block to course page 5) Enrol user in course, login as user, complete course view the Self completion block 6) Run cron (course_completed event should trigger from the cron) Event data supplied in event should match the corresponding record in the course_completions table.
    • Workaround:
      Hide

      People have worked around it by checking cmi.core.lesson_status to see if one particular SCORM was completed.
      That does not always mean the entire course is complete, and it's driven by polling rater than an event.

      Show
      People have worked around it by checking cmi.core.lesson_status to see if one particular SCORM was completed. That does not always mean the entire course is complete, and it's driven by polling rater than an event.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
    • Rank:
      43290

      Description

      A "course completed" event is documented on the events wish list. Implementing it appears to be a one line addition.

      Would it make sense to add:

      events_trigger('completed_course', $this);

      to lib/completion/completion_completion.php so that other modules can act when a course is completed,
      to send notifications for example, or notify an external institutional system, or to issue a certificate,
      or open up a post requisite course - whatever modules want to do when a course is completed?

      In our case, we wish to notify the university level system that the course has been completed, but it seems
      that a "completed_course" event would be useful in many ways. Is lib/completion/completion_completion.php the
      right place to add that?

      See also:
      http://moodle.org/mod/forum/discuss.php?d=207586#p909679

      PS I used the name "completed_course" so that "completed_" could later be a common prefix for "completed_activity", "completed_quiz" etc. as needed in the future.

        Activity

        Hide
        Aaron Barnes added a comment -

        Hi guys,

        Thanks for the excellent bug report - here's a patch in appreciation!

        Note to peer reviewer: what's the convention for event names?

        Cheers,
        Aaron

        Show
        Aaron Barnes added a comment - Hi guys, Thanks for the excellent bug report - here's a patch in appreciation! Note to peer reviewer: what's the convention for event names? Cheers, Aaron
        Hide
        Ray Morris added a comment -

        Here is the same patch based against 2.2.1 for the convenience of those running 2.2.x.
        The only difference is that line numbers are significantly different.

        Show
        Ray Morris added a comment - Here is the same patch based against 2.2.1 for the convenience of those running 2.2.x. The only difference is that line numbers are significantly different.
        Hide
        Dan Poltawski added a comment -

        Hi Aaron,

        Looks good to me. I do not know about a convention for event names, however your implementation looks sensible and matches what is already there.

        +1

        Show
        Dan Poltawski added a comment - Hi Aaron, Looks good to me. I do not know about a convention for event names, however your implementation looks sensible and matches what is already there. +1
        Hide
        Ray Morris added a comment - - edited

        This is a corrected and TESTED patch against 2.2.
        The 10/Aug/12 patch won't actually work against 2.2, though it may work against a newer version.

        Show
        Ray Morris added a comment - - edited This is a corrected and TESTED patch against 2.2. The 10/Aug/12 patch won't actually work against 2.2, though it may work against a newer version.
        Hide
        Aaron Barnes added a comment -

        Hi Ray,

        It appears you are on an old version of 2.2 (pre 2.2.4). The patch I have linked to on github is suitable for 2.2.4. I highly suggest you upgrade your install as not only could you be behind on security fixes but also there was significant work done to course completion in 2.2.4 to improve it's reliability.

        Cheers,
        Aaron

        Show
        Aaron Barnes added a comment - Hi Ray, It appears you are on an old version of 2.2 (pre 2.2.4). The patch I have linked to on github is suitable for 2.2.4. I highly suggest you upgrade your install as not only could you be behind on security fixes but also there was significant work done to course completion in 2.2.4 to improve it's reliability. Cheers, Aaron
        Hide
        Ray Morris added a comment -

        Thanks for that info. Without turning this tracker into a discussion about the 2.2.1 to 2.2.4 Completion changes,
        would you say that the changes within Completion are heavily dependent on changes in other pats of Moodle?
        That is, might it be reasonable for me to patch Completion v2.2.4 to be able to drop into Moodle 2.2.1? We're not likely to be able to upgrade the whole Moodle at this stage in our internal process. (As a government agency, we're methodical, not agile.)

        Show
        Ray Morris added a comment - Thanks for that info. Without turning this tracker into a discussion about the 2.2.1 to 2.2.4 Completion changes, would you say that the changes within Completion are heavily dependent on changes in other pats of Moodle? That is, might it be reasonable for me to patch Completion v2.2.4 to be able to drop into Moodle 2.2.1? We're not likely to be able to upgrade the whole Moodle at this stage in our internal process. (As a government agency, we're methodical, not agile.)
        Hide
        Aaron Barnes added a comment -

        Hi Ray,

        Here is an edited comment that I have supplied in the past:

        MDL-32203 - Course completion data object misses records
        MDL-28949 - Duplicated course completion entries in database not handled correctly
        MDL-33398 - Cron fails when course completion is enabled

        These three patches should fix any critical issues with course completion you might have - if not, please feel free to send me an email

        Cheers and good luck!
        Aaron

        Show
        Aaron Barnes added a comment - Hi Ray, Here is an edited comment that I have supplied in the past: MDL-32203 - Course completion data object misses records MDL-28949 - Duplicated course completion entries in database not handled correctly MDL-33398 - Cron fails when course completion is enabled These three patches should fix any critical issues with course completion you might have - if not, please feel free to send me an email Cheers and good luck! Aaron
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated (23 & master, no way to backport improvements/new features to older stables, aka, 22), thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated (23 & master, no way to backport improvements/new features to older stables, aka, 22), thanks!
        Hide
        Adrian Greeve added a comment -

        Tested in 2.3 and master.
        The code triggered off the code that I wrote.
        It seems to be working.
        Test passed

        Show
        Adrian Greeve added a comment - Tested in 2.3 and master. The code triggered off the code that I wrote. It seems to be working. Test passed
        Hide
        Eloy Lafuente (stronk7) added a comment -

        YEAR!*

        CAF*, TOT!*

        • Your effort amazingly resulted. (unbelievable :-P)
        • Closing as fixed.
        • Tons of thanks.
        Show
        Eloy Lafuente (stronk7) added a comment - YEAR!* CAF*, TOT!* Your effort amazingly resulted. (unbelievable :-P) Closing as fixed. Tons of thanks.
        Hide
        Aaron Barnes added a comment -

        Documented!

        Show
        Aaron Barnes added a comment - Documented!

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: