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

Duplicate entries calling get_records in guess_end

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4
    • 3.4
    • Analytics
    • MOODLE_34_STABLE
    • MOODLE_34_STABLE
    • MDL-60718-master
    • Hide

      Set up

      1. Login as teacher in a course with topics format and without course end date
      2. Follow Course administration ► Users ► Enrolment methods.
      3. Enable 'Self enrolment (Learner)' method.
      4. Login as student and self-enrol in this course.
      5. Login as teacher.
      6. Follow Course administration ► Users ► Enrolled users.
      7. Enrol manually same student.
      8. At this point, in the participants page, this student will have 2 enrolment methods assigned.

      Testing

      1. Execute 'php admin/tool/analytics/cli/guess_course_start_and_end.php --guessall --update'.
      2. You SHOULD NOT get any PHP error.

       

      Show
      Set up Login as teacher in a course with topics format and without course end date Follow Course administration ► Users ► Enrolment methods. Enable 'Self enrolment (Learner)' method. Login as student and self-enrol in this course. Login as teacher. Follow Course administration ► Users ► Enrolled users. Enrol manually same student. At this point, in the participants page, this student will have 2 enrolment methods assigned. Testing Execute 'php admin/tool/analytics/cli/guess_course_start_and_end.php --guessall --update'. You SHOULD NOT get any PHP error.  

    Description

      When some participant is enrolled to a course with more than one methods (for instance first auto-enrolment and after manual), the following error appears when executing 'php admin/tool/analytics/cli/guess_course_start_and_end.php --guessall --update':

       

      Course2 (id = 3): 
      Current start date is good: Monday, 6 November 2017, 8:36 PM
      Can't guess the end date
      ++ Did you remember to make the first column something unique in your call to get_records? Duplicate value '1509616171' found in column 'timeaccess'. ++
      * line 802 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
      * line 363 of /analytics/classes/course.php: call to pgsql_native_moodle_database->get_records_sql()
      * line 172 of /admin/tool/analytics/cli/guess_course_start_and_end.php: call to core_analytics\course->guess_end()
      * line 101 of /admin/tool/analytics/cli/guess_course_start_and_end.php: call to tool_analytics_calculate_course_dates()

       

      Attachments

        Issue Links

          Activity

            People

              sarjona Sara Arjona (@sarjona)
              sarjona Sara Arjona (@sarjona)
              Damyon Wiese Damyon Wiese
              David Monllaó David Monllaó
              David Monllaó David Monllaó
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Nov/17