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

Improve efficiency of grade item sortorder fixing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.4, 2.6.1
    • Fix Version/s: 2.5.5, 2.6.2
    • Component/s: Backup, Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      (Copied from MDL-43306)

      Setup:

      1. Create COURSE1 with default settings
      2. Add an assignment 'Assign 1' with default settings
      3. Create COURSE2 with default settings
      4. Add an assignment 'Assign 2' with default settings
      5. VERIFY: Examine the database and ensure the grade items exist, and both have the same sort order in different courses. e.g:

        SELECT id, itemname, courseid, sortorder 
        FROM mdl_grade_items 
        WHERE itemname LIKE 'Assign%'
        ORDER BY sortorder, courseid;
         
         id | itemname | courseid | sortorder
        ----+----------+----------+-----------
          4 | Assign 1 |        2 |         2
          2 | Assign 2 |        3 |         2
        

      Attempt to create duplicates through import:

      1. Go to COURSE1
      2. Select import, choose COURSE2
      3. Choose ONLY to import ASSIGNCOURSE2
      4. VERIFY: Examine the database and ensure the grade items that are imported don't have duplicate sortorder and courseids:

        SELECT id, itemname, courseid, sortorder 
        FROM mdl_grade_items 
        WHERE itemname like 'Assign%' 
        ORDER BY sortorder, courseid
        ;
         id | itemname | courseid | sortorder
        ----+----------+----------+-----------
          4 | Assign 1 |        2 |         2
          2 | Assign 2 |        3 |         2
          7 | Assign 2 |        2 |         4
        (3 rows)
        

      5. Go to Grades > Categories and items > Simple view and ensure that the grade items for the two assignments appear

      Backup/Restore test:

      1. Backup a course with numerous activities and grade items
      2. VERIFY: it restores without problem.

      phpunit:
      run phpunit lib/grade/tests/grade_item_test.php

      Show
      (Copied from MDL-43306 ) Setup: Create COURSE1 with default settings Add an assignment 'Assign 1' with default settings Create COURSE2 with default settings Add an assignment 'Assign 2' with default settings VERIFY: Examine the database and ensure the grade items exist, and both have the same sort order in different courses. e.g: SELECT id, itemname, courseid, sortorder FROM mdl_grade_items WHERE itemname LIKE 'Assign%' ORDER BY sortorder, courseid;   id | itemname | courseid | sortorder ----+----------+----------+----------- 4 | Assign 1 | 2 | 2 2 | Assign 2 | 3 | 2 Attempt to create duplicates through import: Go to COURSE1 Select import, choose COURSE2 Choose ONLY to import ASSIGNCOURSE2 VERIFY: Examine the database and ensure the grade items that are imported don't have duplicate sortorder and courseids: SELECT id, itemname, courseid, sortorder FROM mdl_grade_items WHERE itemname like 'Assign%' ORDER BY sortorder, courseid ; id | itemname | courseid | sortorder ----+----------+----------+----------- 4 | Assign 1 | 2 | 2 2 | Assign 2 | 3 | 2 7 | Assign 2 | 2 | 4 (3 rows) Go to Grades > Categories and items > Simple view and ensure that the grade items for the two assignments appear Backup/Restore test: Backup a course with numerous activities and grade items VERIFY: it restores without problem. phpunit: run phpunit lib/grade/tests/grade_item_test.php
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull Master Branch:

      Description

      As found in MDL-41062, and fixed in MDL-43946, the SQL for sortorder fixing provide duplicate records (sometimes a lot of them). This ticket is to bring the same fix into the restore code sortorder fix.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emerrill Eric Merrill
                Reporter:
                emerrill Eric Merrill
                Peer reviewer:
                Eloy Lafuente (stronk7)
                Integrator:
                Sam Hemelryk
                Tester:
                David Monllaó
                Participants:
                Component watchers:
                Adrian Greeve, Damyon Wiese, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Mar/14