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

Course completion data object misses records

XMLWordPrintable

    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • 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.

      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.

            sry_not4sale Aaron Barnes
            sry_not4sale Aaron Barnes
            Dan Poltawski Dan Poltawski
            Sam Hemelryk Sam Hemelryk
            Rajesh Taneja Rajesh Taneja
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.