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

Activity completion API sets timemodified to 0 in database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.16
    • Fix Version/s: None
    • Component/s: Activity completion
    • Labels:
    • Environment:
      PHP 7.2.24-0
      ubuntu18.04.7
    • Database:
      MySQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Steps to reproduce it on clean moodle35_16:

      (I reproduced it using SCORM)

      1. Login as admin
      2. Open course
      3. Add scorm package with random name.
      4. Upload for example this Package file (see attachment)
      5. Set Activity completion settings as on screenshot
      6. Save activity
      7. Login as normal user enrolled in course
      8. Enter this scorm in normal mode
      9. Watch one slide and click "Exit activity" , don't watch till end.
      10. In `mdl_course_modules_completion` table there should be new record with timemodified = 0 (see screenshot)
      12. Login again as admin
      13. Go to course > Course administration > Reports > Activity completion ( /report/progress/index.php?course=2 )
      14. Download in spreadsheet format (UTF-8 .csv)
      15. In csv should record with "Thursday, 1 January 1970, 1:00 AM"
       

      LOGS 

      SELECT * FROM `mdl_log_queries` WHERE `sqltext` LIKE '%mdl_course_modules_completion%' ORDER BY `id` DESC

      SQL TEXT:
      INSERT INTO mdl_course_modules_completion (coursemoduleid,userid,completionstate,viewed,overrideby,timemodified) VALUES(?,?,?,?,?,?)

      SQL PARAMS
      array (
        0 => '7',
        1 => '5',
        2 => 0,
        3 => 1,
        4 => NULL,
        5 => 0,
      )

      Backtrace:

      • line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 1049 of /lib/completionlib.php: call to mysqli_native_moodle_database->insert_record()
      • line 738 of /lib/completionlib.php: call to completion_info->internal_set_data()
      • line 159 of /mod/scorm/player.php: call to completion_info->set_module_viewed()

        Attachments

        1. database.png
          57 kB
          Jakub Kleban
        2. settings.png
          43 kB
          Jakub Kleban

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jakubkleban Jakub Kleban
            Participants:
            Component watchers:
            Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: