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

Improve efficiency of grade item sortorder fixing

    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 2.6 Branch:
      MDL-44046_m26
    • 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.

        Gliffy Diagrams

          Issue Links

            Activity

            Show
            cibot CiBoT added a comment - Results for MDL-44046 Remote repository: https://github.com/merrill-oakland/moodle.git Remote branch MDL-44046 _m25 to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/1148 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/1148/artifact/work/smurf.html Remote branch MDL-44046 _m26 to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/1149 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/1149/artifact/work/smurf.html Remote branch MDL-44046 to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/1150 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/1150/artifact/work/smurf.html
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Same logic than upgrade (surely less problematic here, though) so, sending to integration. Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Same logic than upgrade (surely less problematic here, though) so, sending to integration. Thanks!
            Hide
            cibot CiBoT added a comment -

            Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

            Show
            cibot CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Hoorah, its always nice reviewing something I'd reviewed earlier in the day.

            This has been integrated now thanks Eric.

            Show
            samhemelryk Sam Hemelryk added a comment - Hoorah, its always nice reviewing something I'd reviewed earlier in the day. This has been integrated now thanks Eric.
            Hide
            dmonllao David Monllaó added a comment -

            It passes, thanks. Tested in 25, 26 and master

            Show
            dmonllao David Monllaó added a comment - It passes, thanks. Tested in 25, 26 and master
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Fetch your remotes, prune them,
            clean your integrated branches and say "Ahem".

            Rebase your ongoing stuff, keep conflicts away
            don't forget to test the code and we'll love you again.

            Thanks, closing!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Fetch your remotes, prune them, clean your integrated branches and say "Ahem". Rebase your ongoing stuff, keep conflicts away don't forget to test the code and we'll love you again. Thanks, closing!

              People

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

                Dates

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