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

chat_prepare_update_events is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.5, 3.4.2
    • 3.4.1
    • Chat
    • MOODLE_34_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-61375_master
    • 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

      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.

            markn Mark Nelson
            nwpotago Nick Phillips
            Shamim Rezaie Shamim Rezaie
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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