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

Course completion data object misses records

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.8, 2.1, 2.2
    • Fix Version/s: 2.1.7, 2.2.4
    • Component/s: Course completion
    • Labels:
    • Testing Instructions:
      Hide

      To test that these changes do not affect the use of course completion:

      Enable course completion in site advanced settings
      Create a new course, enabling completion
      In the "completion" menu in course settings, enable some criteria
      Add the completion status block to course
      Enrol users in the course
      Have them complete some of the criteria (cron run will be required to have their "completion" register in system)
      View their progress in the completion status block (as the learner), or in the completion course report as a teacher/siteadmin

      No coding or critical errors should occur.

      Show
      To test that these changes do not affect the use of course completion: Enable course completion in site advanced settings Create a new course, enabling completion In the "completion" menu in course settings, enable some criteria Add the completion status block to course Enrol users in the course Have them complete some of the criteria (cron run will be required to have their "completion" register in system) View their progress in the completion status block (as the learner), or in the completion course report as a teacher/siteadmin No coding or critical errors should occur.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:

      Description

      The class data_object is the base of all completion classes. It was originally subclasses from grade_object as it was assumed this was a good piece of code to base a similar solution on ( how wrong we were! ).

      It has be come apparent that the constructor is a bit too specific with it's where clauses, and if it is used to fetch a record it will include all data passed to it in the where clause. This causes issues as sometimes it will fail to locate a record in the database, and instead of updating will insert a duplicate record causing issues later on. This seems to occur frequently due to issues with concurrency, especially since a lot of work is passed off to the cron and a lot of calls to the constructor include unneccessary data like timemodified.

      Attached is the code to fix this issue, which is the cause of a majority of the duplicate record issues in course completion. It has been tried and tested in it's 1.9 form in Totara for many months now.

      The next step is to add unique indexes to relevant tables, but I understand that has to happen in master as is a database change while I am hoping this commit can make it's way into earlier versions.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  3 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Jul/12