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

Course in "Weeks" format can suggest the course end date automatically

    XMLWordPrintable

Details

    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-56251_master
    • Hide
      Prerequisites
      1. Visit 'Site administration' > 'Courses' > 'Courses default settings'.
      2. Set the default format to 'Weekly format'.
      Test 1 (before upgrade) - test this on all supported databases.
      1. Create a course (C1) using the weekly format and set the end date to sometime in the future (make a mental note of it).
      2. Create a course (C2) using the weekly format that has no end date (disable the end date field).
      3. Create a course (C3) using the topics format and set the end date to sometime in the future (make a mental note of it).
      4. Create a course (C4) using the topics format that has no end date (disable the end date field).
      5. Upgrade.
      6. Edit the course C2 and confirm the setting 'Calculate the end date from the number of sections' enabled.
      7. Check the database table 'course' and confirm that C2's end date accurately reflects the number of weeks it contains (take the enddate minus the startdate to get the seconds and then convert into weeks).
      8. Edit the courses C1, C3 and C4 and confirm their settings were unaffected.
      Test 2
      1. Log in as an admin on a Moodle 3.2 site.
      2. Create a course (C1) using the weekly format and set the end date to sometime in the future (make a mental note of it).
      3. Create a course (C2) using the weekly format that has no end date (disable the end date field).
      4. Backup both courses.
      5. Restore the courses on integration master.
      6. Edit the course C1 and confirm the setting 'Calculate the end date from the number of sections' is disabled and the end date is accurate.
      7. Edit the course C2 and confirm the setting 'Calculate the end date from the number of sections' is enabled.
      Test 3
      1. Go to the form for creating a course.
      2. Confirm the 'Course end date' field is disabled.
      3. Confirm the 'Calculate the end date from the number of sections' field is enabled.
      4. Uncheck 'Calculate the end date from the number of sections'.
      5. Confirm the end date is now enabled.
      6. Set the course end date to 5 weeks ahead of the start date.
      7. Fill in the required fields and save.
      8. Re-edit the course.
      9. Confirm the end date is enabled and the same as it was when you created it.
      10. Confirm 'Calculate the end date from the number of sections' is unchecked.
      Test 4
      1. Go to the form for creating a course.
      2. Open the tab 'Course formats'.
      3. Set the number of sections to 6.
      4. Fill in the required fields and save.
      5. Confirm in the database the end date is 6 weeks ahead of the start date (take the enddate minus the startdate to get the seconds and then convert into weeks).
      6. Visit the course.
      7. Add two sections.
      8. Confirm in the database the end date is now 8 weeks ahead of the start date.
      9. Remove three sections.
      10. Confirm in the database the end date is now 5 weeks ahead of the start date.
      Test 5
      1. Create a course called '1 week' with 1 week and 'Calculate the end date from the number of sections' set.
      2. Create a course called '10 weeks' with 10 weeks.
      3. Backup the 10 week course.
      4. Restore the 10 week course into the 1 week course (merge).
      5. Confirm in the database the end date is 10 weeks ahead of the startdate for the 1 week course.
      Test 6
      1. Confirm all unit tests are passing.
      Regression test for numsections restore (from MDL-57769)
      1. On a different instance on 3.2 or earlier: create a courses in weeks formats, add activities to the last section(s) and then "decrease number of sections" so you have orphaned activities. Backup this course and save the backup file
      2. On integration master restore this backup as a new course and make sure that restored orphaned sections are hidden and activities inside them are "Available but not visible on course page"
      3. Restore this backup into existing course that has lesser number of sections (select "overwrite course configuration"), make sure the orphaned sections were restored as hidden
      4. Restore the backup into existing course by merging without overwriting course configuration. The number of sections should become the maximum of what was in original course and the backup course. Note: if you do not select "overwrite course configuration" the information about number of sections in the backup file is not processed so no sections will be marked hidden by the restore process.
      Show
      Prerequisites Visit 'Site administration' > 'Courses' > 'Courses default settings'. Set the default format to 'Weekly format'. Test 1 (before upgrade) - test this on all supported databases. Create a course (C1) using the weekly format and set the end date to sometime in the future (make a mental note of it). Create a course (C2) using the weekly format that has no end date (disable the end date field). Create a course (C3) using the topics format and set the end date to sometime in the future (make a mental note of it). Create a course (C4) using the topics format that has no end date (disable the end date field). Upgrade. Edit the course C2 and confirm the setting 'Calculate the end date from the number of sections' enabled. Check the database table 'course' and confirm that C2's end date accurately reflects the number of weeks it contains (take the enddate minus the startdate to get the seconds and then convert into weeks). Edit the courses C1, C3 and C4 and confirm their settings were unaffected. Test 2 Log in as an admin on a Moodle 3.2 site. Create a course (C1) using the weekly format and set the end date to sometime in the future (make a mental note of it). Create a course (C2) using the weekly format that has no end date (disable the end date field). Backup both courses. Restore the courses on integration master. Edit the course C1 and confirm the setting 'Calculate the end date from the number of sections' is disabled and the end date is accurate. Edit the course C2 and confirm the setting 'Calculate the end date from the number of sections' is enabled. Test 3 Go to the form for creating a course. Confirm the 'Course end date' field is disabled. Confirm the 'Calculate the end date from the number of sections' field is enabled. Uncheck 'Calculate the end date from the number of sections'. Confirm the end date is now enabled. Set the course end date to 5 weeks ahead of the start date. Fill in the required fields and save. Re-edit the course. Confirm the end date is enabled and the same as it was when you created it. Confirm 'Calculate the end date from the number of sections' is unchecked. Test 4 Go to the form for creating a course. Open the tab 'Course formats'. Set the number of sections to 6. Fill in the required fields and save. Confirm in the database the end date is 6 weeks ahead of the start date (take the enddate minus the startdate to get the seconds and then convert into weeks). Visit the course. Add two sections. Confirm in the database the end date is now 8 weeks ahead of the start date. Remove three sections. Confirm in the database the end date is now 5 weeks ahead of the start date. Test 5 Create a course called '1 week' with 1 week and 'Calculate the end date from the number of sections' set. Create a course called '10 weeks' with 10 weeks. Backup the 10 week course. Restore the 10 week course into the 1 week course (merge). Confirm in the database the end date is 10 weeks ahead of the startdate for the 1 week course. Test 6 Confirm all unit tests are passing. Regression test for numsections restore (from MDL-57769 ) On a different instance on 3.2 or earlier: create a courses in weeks formats, add activities to the last section(s) and then "decrease number of sections" so you have orphaned activities. Backup this course and save the backup file On integration master restore this backup as a new course and make sure that restored orphaned sections are hidden and activities inside them are "Available but not visible on course page" Restore this backup into existing course that has lesser number of sections (select "overwrite course configuration"), make sure the orphaned sections were restored as hidden Restore the backup into existing course by merging without overwriting course configuration. The number of sections should become the maximum of what was in original course and the backup course. Note: if you do not select "overwrite course configuration" the information about number of sections in the backup file is not processed so no sections will be marked hidden by the restore process.

    Description

      Follow up for MDL-22078 "course end date".
      Some course formats, for example format_weeks can automatically predict the course end_date = start_date + number_of_sections * 7days. There are many ways how teacher can change number of sections (edit settings, delete sections, call course/changenumsections.php, restore, import, etc)

      Option 1: do not allow to modify course end date manually and automatically set it after each modification of number of sections.

      Option 2: add a warning (visible only to users with capability to edit course settings) when they view the course page. Something like "Course end date is set to X but it should be Y based on the start date Z and duration of N weeks. Adjust"
      And a quick action link to fix the end date without filling the form.

      There could be situations when the teacher decides to set end date different on purpose. But do we need to care about them? Should we add a setting that switches auto-adjust on and off or just always do it?

      Attachments

        Issue Links

          Activity

            People

              markn Mark Nelson
              marina Marina Glancy
              Marina Glancy Marina Glancy
              Jake Dallimore Jake Dallimore
              Simey Lameze Simey Lameze
              Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/May/17