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

Importing questions into lesson from file will cause lesson to no longer be editable

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create/edit a lesson
      2. Import questions from file (Example XML has been attached)
      3. Check the lesson_pages table and make sure the previd and nextid are pointed to the correct page.
      4. Select 'edit' tab and 'collapse' tab, make sure there's no notice for resetting the page order

      Use the above steps to import question:

      1. Into an empty lesson
      2. Into a lesson before the first question
      3. Into a lesson after the last question
      4. Into a lesson between existing questions

      To test the upgrade script:

      1. On each branch WITHOUT this patch integrated:
      2. Create an empty lesson
      3. Create 2 content pages with next, previous and end of lesson links
      4. Import the questions from file (xml file attached) after the first page
      5. Attempt to edit the lesson (will eventually get a page timeout)
      6. Update the code to a version that includes this patch
      7. check lesson edit page on the browser and make sure there's no error occurs.

      Note: order for the corrupted lesson_pages might not the same as previously.

      Sample lesson data (This needs to be done manually. Providing a backup for corrupted lesson won't works because the page order will be fixed automatically during restore.)

      3 lessons with 4 pages for each lesson.
       
      validation 1: Prev/next page id is exist within the lesson.
      lessonid 	pageid	        prev	        next
      1		1		0		22222
      1		2		1		3
      1		3		2		4
      1		4		353535	        0
       
       
      validation 2: Duplicate prev/next page id.
      lessonid 	pageid	        prev	        next
      2		5		0		6
      2		6		5		7
      2		7		6		7
      2		8		7		0
       
       
      validation 3: No existence of first and/or last page.
      lessonid 	pageid	        prev	        next
      3		9		12		10
      3		10		9		11
      3		11		10		12
      3		12		11		9
      

      Show
      Create/edit a lesson Import questions from file (Example XML has been attached) Check the lesson_pages table and make sure the previd and nextid are pointed to the correct page. Select 'edit' tab and 'collapse' tab, make sure there's no notice for resetting the page order Use the above steps to import question: Into an empty lesson Into a lesson before the first question Into a lesson after the last question Into a lesson between existing questions To test the upgrade script: On each branch WITHOUT this patch integrated: Create an empty lesson Create 2 content pages with next, previous and end of lesson links Import the questions from file (xml file attached) after the first page Attempt to edit the lesson (will eventually get a page timeout) Update the code to a version that includes this patch check lesson edit page on the browser and make sure there's no error occurs. Note: order for the corrupted lesson_pages might not the same as previously. Sample lesson data (This needs to be done manually. Providing a backup for corrupted lesson won't works because the page order will be fixed automatically during restore.) 3 lessons with 4 pages for each lesson.   validation 1: Prev/next page id is exist within the lesson. lessonid pageid prev next 1 1 0 22222 1 2 1 3 1 3 2 4 1 4 353535 0     validation 2: Duplicate prev/next page id. lessonid pageid prev next 2 5 0 6 2 6 5 7 2 7 6 7 2 8 7 0     validation 3: No existence of first and/or last page. lessonid pageid prev next 3 9 12 10 3 10 9 11 3 11 10 12 3 12 11 9
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-35851-master
    • Sprint:
      FRONTEND Sprint 1

      Description

      After importing questions from an xml file in between 2 pages in a lesson the lesson is no longer editable. This is caused because the code gets stuck in an infinite loop due to the page order no loner being correct.

      Procedure to reproduce:

      • Create a lesson
      • Edit the lesson
      • Create a content page with buttons for prev page, next page, end of content.
      • Create 2nd content page similar
      • Click on link to view content page 1
      • Use the option import questions
      • Import questions from file (Example XML has been attached)
      • Once it uploads click edit within the lesson not edit lesson activity
      • If it doesn't show anything than it is in a infinite loop

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Sep/13