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

Handle minmaxtouse when restoring a course

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Pre-requisites

      You need to prepare a few backup files, take note of backup ID that I give you, and the version it was created on.

      Prepare those backups on 2.7, 2.8.5, 2.9.0:

      1. Create a course and customise your gradebook (See MDL-48618 for combination ideas)
      2. Make sure you've enrolled at least one student
      3. Give some grades to the student
        • Take a screenshot of the student's grades, or save them to compare them later
      4. Backup your course (default settings) (backup A)
      5. Now back to the gradebook, change the maxgrade of an item
        • Take a screenshot of the student's grades, or save them to compare them later
      6. Backup your course again (default settings) (backup B)
      7. And backup again but this time excluding the user data (backup C)

      Prepare those backups on the latest-integration 2.8, 2.9, master:

      1. Set $CFG->grade_minmaxtouse to "Initial min and max grades"
      2. Create a course and customise your gradebook (See MDL-48618 for combination ideas)
      3. Set the course grade setting "Min and max grades used in calculation" to default
      4. Make sure you've enrolled at least one student
      5. Give some grades to the student
      6. Now back to the gradebook, change the maxgrade of an item
        • Take a screenshot of the student's grades, or save them to compare them later
      7. Backup your course again (default settings) (backup D)
      8. Change the course setting "Min and max grades used in calculations" to "Min and max grades as specified in grade item settings"
        • Take a screenshot of the student's grades, or save them to compare them later
      9. Backup your course again (default settings) (backup E)

      Test restore as new course

      The grades after the restore must be identical as the ones at the time of the backup!

      1. Set $CFG->grade_minmaxtouse to its default (min max from grade item)
      2. Restore those backups and make sure that the course that was restored using...
        1. Backup A 2.7.x: has the course setting "Min max to use" set to "Default"
        2. Backup A 2.8.5 and 2.9.0: have the course setting "Min max to use" set to "Default"
        3. Backup B 2.8.5 and 2.9.0:
          • has the course setting "Min max to use" set to "Initial min and max"
          • has a notice on the gradebook
      3. Set $CFG->grade_minmaxtouse to initial min and max
      4. Restore those backups and make sure that the course that was restored using...
        1. Backup B 2.7.x: has the course setting "Min max to use" set to "Min max from grade item"
        2. Backup B 2.8.5 and 2.9.0:
          • have the course setting "Min max to use" set to "Default"
          • have a notice on the gradebook
      5. Restore those backups and make sure that the course that was restored using...
        1. Backup C 2.8.5 and 2.9.0:
          • has the course setting "Min max to use" set to "Default"
          • do not have a notice on the gradebook
      6. Restore those backups and make sure that the course that was restored using...
        1. Backup D 2.8/2.9/master
          • have the course setting "Min max to use" set to "Initial min and max grades"
          • do not have a notice on the gradebook
        2. Backup E 2.8/2.9/master
          • have the course setting "Min max to use" set to "Min max from grade item"
          • do not have a notice on the gradebook

      Test restore as merge

      1. Create a blank course
      2. 2.7/2.8.5/2.9.0 backups restored as merge will NOT change the course setting "Min max to use", even if set to default.
      3. 2.8/2.9/master backups restored as merge will NOT set the course setting "Min max to use"
      4. Try again with merge that deletes the whole content
      5. 2.7/2.8.5/2.9.0 backups restored will NOT change the course setting "Min max to use", even if set to default.
      6. 2.8/2.9/master backups restored WILL set the course setting "Min max to use"
      Show
      Pre-requisites You need to prepare a few backup files, take note of backup ID that I give you, and the version it was created on. Prepare those backups on 2.7, 2.8.5, 2.9.0: Create a course and customise your gradebook (See MDL-48618 for combination ideas) Make sure you've enrolled at least one student Give some grades to the student Take a screenshot of the student's grades, or save them to compare them later Backup your course (default settings) (backup A) Now back to the gradebook, change the maxgrade of an item Take a screenshot of the student's grades, or save them to compare them later Backup your course again (default settings) (backup B) And backup again but this time excluding the user data (backup C) Prepare those backups on the latest-integration 2.8, 2.9, master: Set $CFG->grade_minmaxtouse to "Initial min and max grades" Create a course and customise your gradebook (See MDL-48618 for combination ideas) Set the course grade setting "Min and max grades used in calculation" to default Make sure you've enrolled at least one student Give some grades to the student Now back to the gradebook, change the maxgrade of an item Take a screenshot of the student's grades, or save them to compare them later Backup your course again (default settings) (backup D) Change the course setting "Min and max grades used in calculations" to "Min and max grades as specified in grade item settings" Take a screenshot of the student's grades, or save them to compare them later Backup your course again (default settings) (backup E) Test restore as new course The grades after the restore must be identical as the ones at the time of the backup! Set $CFG->grade_minmaxtouse to its default (min max from grade item) Restore those backups and make sure that the course that was restored using... Backup A 2.7.x: has the course setting "Min max to use" set to "Default" Backup A 2.8.5 and 2.9.0: have the course setting "Min max to use" set to "Default" Backup B 2.8.5 and 2.9.0: has the course setting "Min max to use" set to "Initial min and max" has a notice on the gradebook Set $CFG->grade_minmaxtouse to initial min and max Restore those backups and make sure that the course that was restored using... Backup B 2.7.x: has the course setting "Min max to use" set to "Min max from grade item" Backup B 2.8.5 and 2.9.0: have the course setting "Min max to use" set to "Default" have a notice on the gradebook Restore those backups and make sure that the course that was restored using... Backup C 2.8.5 and 2.9.0: has the course setting "Min max to use" set to "Default" do not have a notice on the gradebook Restore those backups and make sure that the course that was restored using... Backup D 2.8/2.9/master have the course setting "Min max to use" set to "Initial min and max grades" do not have a notice on the gradebook Backup E 2.8/2.9/master have the course setting "Min max to use" set to "Min max from grade item" do not have a notice on the gradebook Test restore as merge Create a blank course 2.7/2.8.5/2.9.0 backups restored as merge will NOT change the course setting "Min max to use", even if set to default. 2.8/2.9/master backups restored as merge will NOT set the course setting "Min max to use" Try again with merge that deletes the whole content 2.7/2.8.5/2.9.0 backups restored will NOT change the course setting "Min max to use", even if set to default. 2.8/2.9/master backups restored WILL set the course setting "Min max to use"
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50569-master
    • Sprint:
      Team '; drop tables Sprint 7

      Description

      There are a few things to handle here:

      • Courses from <= 2.7 are missing the setting in their backups, we need to set it to grade_item.
      • Courses from (>= 2.8 AND < 2.8.7) OR (>= 2.9 AND < 2.9.1), we need to set it to grade_grade.
      • Other courses should be using the same logic they were when they were backed up, which is tricky as when they are using the default system setting, we have no trace of it.

      David Monllaó, on MDL-48618:

      Backups, minmaxinuse course level setting is attached to backups, but backup a 2.8.0 (non synchronized grade_grades - grade_items) course into a 2.8.7 (with this patch included) there will be no minmaxinuse setting in the course backup so the default system value will be used; would be better to show the warning to teachers and make them choose.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  6/Jul/15