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

User Activity report > Statistics gives get_records() warning messages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.10, 2.8.8, 2.9.2
    • Fix Version/s: 2.8.10, 2.9.4
    • Component/s: Reports
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as admin user
      2. Make sure site statistics are enabled (here is the docs page)
      3. Download and run the attached script "generate_stats.php" which will create some duplicate log entries to ensure that timeend matches (which is what causes this issue)
      4. Run cron to generate the stats (if it doesn't immediately work you may have to try a few of the troubleshooting things from the docs page and maybe check the admin setting for when cron stats should start (see admin/settings.php?section=stats) and ensure your system clock is after that date)
      5. View the stats_user_daily table in the database and ensure there are entries that have duplicate "timeend" values. Take note of the course id and user id.
      6. View the log report (site admin > reports > logs)
      7. Click on the user that corresponds to the user id from the status table (no big deal if you don't know, since you can just change the query params if needed)
      8. You should be on the user's course profile page, so click on "statistics".
      9. You may need to adjust the id and course URL params to match the ones you noted from status_user_daily table
      10. Confirm that you don't see the error "Did you remember to make the first column something unique in your call to get_records"
      Show
      Log in as admin user Make sure site statistics are enabled (here is the docs page ) Download and run the attached script "generate_stats.php" which will create some duplicate log entries to ensure that timeend matches (which is what causes this issue) Run cron to generate the stats (if it doesn't immediately work you may have to try a few of the troubleshooting things from the docs page and maybe check the admin setting for when cron stats should start (see admin/settings.php?section=stats) and ensure your system clock is after that date) View the stats_user_daily table in the database and ensure there are entries that have duplicate "timeend" values. Take note of the course id and user id. View the log report (site admin > reports > logs) Click on the user that corresponds to the user id from the status table (no big deal if you don't know, since you can just change the query params if needed) You should be on the user's course profile page, so click on "statistics". You may need to adjust the id and course URL params to match the ones you noted from status_user_daily table Confirm that you don't see the error "Did you remember to make the first column something unique in your call to get_records"
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-51913_statistics_dup_1st_column

      Description

      Logged in as admin user
      Ran log reports for yesterday
      Selected a user
      Then clicked on activity reports, statistics and got the following error message:

      "Did you remember to make the first column something unique in your call to get_records? Duplicate value '1438387200' found in column 'timeend'.

      • line 1089 of /lib/dml/mysqli_native_moodle_database.php: call to debugging()
      • line 112 of /report/stats/user.php: call to mysqli_native_moodle_datbase->get_records_sql()

        Attachments

        1. generate_stats.php
          5 kB
        2. statsrows.png
          statsrows.png
          19 kB
        3. User Statistics.PNG
          User Statistics.PNG
          436 kB

          Issue Links

            Activity

              People

              Assignee:
              barrysspace Barry Oosthuizen
              Reporter:
              barrysspace Barry Oosthuizen
              Peer reviewer:
              Ryan Wyllie
              Integrator:
              David Monllaó
              Tester:
              Simey Lameze
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jan/16