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

External function: update_categories does not update the path field when moving category

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • Hide

      Run the REST demo client
      Call core_course_update_categories(). You must move a category from a parent to another parent. Check that the moved category has a correct path. For example if it was moved from category1->id = 4 to category2->id = 5, then the path should have been updated from /4/X to /5/X

      You can check the path field in the DB table: course_categories

      Alternative test:
      you can take my phpunit test for this function in https://github.com/mouneyrac/moodle/commit/bae128d5e1124a191d00648e1aca57f6b407ca1c (MDL-33529) - it's done and it will be much faster test to call this unit test (if you do so, comment the other PHPunit test because lots of them are related to fix waiting to be integrated. If you don't comment other tests they will throw errors to you.)

      Show
      Run the REST demo client Call core_course_update_categories(). You must move a category from a parent to another parent. Check that the moved category has a correct path. For example if it was moved from category1->id = 4 to category2->id = 5, then the path should have been updated from /4/X to /5/X You can check the path field in the DB table: course_categories Alternative test: you can take my phpunit test for this function in https://github.com/mouneyrac/moodle/commit/bae128d5e1124a191d00648e1aca57f6b407ca1c ( MDL-33529 ) - it's done and it will be much faster test to call this unit test (if you do so, comment the other PHPunit test because lots of them are related to fix waiting to be integrated. If you don't comment other tests they will throw errors to you.)

      fix_course_sortorder() called is overwritten by a later $DB->update call.

      To fix:

      // Get updated path by move_category().
      $category->path = $DB->get_field('course_categories', 'path',
                              array('id' => $category->id));

            jerome Jérôme Mouneyrac
            jerome Jérôme Mouneyrac
            Sam Hemelryk Sam Hemelryk
            Jason Fowler Jason Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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