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

chat_prepare_update_events is broken

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.1
    • Fix Version/s: 3.3.5, 3.4.2
    • Component/s: Chat
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course.
      2. Create a chat activity that has a next chat time and set this to publish ‘At the same time every day’, for ‘Activity completion’ set an ‘Expect completed on’ date.
      3. Edit the chat activity and save, ensure there are no errors.
      4. Open a terminal and go to your Moodle instance's root folder.
      5. Run cron and ensure there are no errors:

        php admin/cli/cron.php
        

      Show
      Create a course. Create a chat activity that has a next chat time and set this to publish ‘At the same time every day’, for ‘Activity completion’ set an ‘Expect completed on’ date. Edit the chat activity and save, ensure there are no errors. Open a terminal and go to your Moodle instance's root folder. Run cron and ensure there are no errors: php admin/cli/cron.php
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61375_master

      Description

      The function chat_prepare_update_events in mod/chat/lib.php (MOODLE_34_STABLE) makes an incorrect assumption that causes an exception in the cron.

      Line 497:

      $DB->get_field('event', 'id', array('modulename' => 'chat', 'instance' => $chat->id))

      This assumes that there will never be 2 separate entries in the event table with the same instance and modulename. This is incorrect. Chat creates a 'chattime' entry for a scheduled chat, and a 'expectcompletionon' entry for expected completion date.

      When these both exist, get_field throws an exception.

      The comment for the function clearly anticipates this, but the code doesn't.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h