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

Add a new availability completion option - "previous activity with completion"

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Most use cases have acceptance test implemented:

      1. PHPUnitTest: vendor/bin/phpunit my/tests/filename.php availability/condition/completion/tests/condition_test.php
      2. behat: vendor/bin/behat -
        -config DATAPATH/moodledata_behat/behatrun/behat/behat.yml --tags=@availability_completion

      But there are 3 uses cases that need some manual testing.

      Test pre-requisites

      1. Create a course with a user enrolled as editing teacher
      2. Generate this course structure:
        1. Topic/Week 1
          1. Activity Page1: a mod_page with
            1. manual completion
        2. Topic/Week 2: change the name to "2nd section" and add a restrict access "activity completion" to the section configured as "Previous activity with completion" and "must be marked completed"
          1. Activity Page2: a mod page with
            1. manual completion
            2. restrict access "activity completion" configured as "Previous activity with completion" and "must be marked completed"
        3. Topic/Week 3: change the name to "3rd section" and add a restrict access "activity completion" to the section configured as "Previous activity with completion" and "must be marked completed"
          1. Activity Page3: a mod page with
            1. manual completion
            2. restrict access "activity completion" configured as "Previous activity with completion" and "must be marked completed"
        4. Topic/Week 4: empty
      3. Log in as the enrolled teacher user
      4. Access the course

      Manual test 01: move activity

      1. Check: Page2 restriction should be "Not available unless: The activity Page1 is marked complete"
      2. Check: Page3 restriction should be  "Not available unless: The activity Page2 is marked complete"
      3. Turn on editing
      4. Check: Page2 restriction should be "Not available unless: The previous activity with completion is marked complete"
      5. Check: Page3 restriction should be  "Not available unless: The previous activity with completion is marked complete"
      6. Move Page2 activity to section/week 4
      7. Turn off editing
      8. Check: Page2 restriction should be "Not available unless: The activity Page3 is marked complete"
      9. Check: Page3 restriction should be  "Not available unless: The activity Page1 is marked complete"
      10. Turn editing ON again and move back Page2 to section/week 2 before continuing the test
      11. Turn editing OFF

      Manual test 02: move section

      1. Check: 2nd section restriction should be "Not available unless: The activity Page1 is marked complete"
      2. Check: 3rd section restriction should be  "Not available unless: The activity Page2 is marked complete"
      3. Turn on editing
      4. Check: 2nd section restriction should be "Not available unless: The previous activity with completion is marked complete"
      5. Check: 3rd section restriction should be  "Not available unless: The previous activity with completion is marked complete"
      6. Move Topic/Week 2 section after section/week 3
      7. Turn off editing
      8. Check: The old 2nd section restriction should be "Not available unless: The activity Page3 is marked complete"
      9. Check: 3rd section restriction should be  "Not available unless: The activity Page1 is marked complete"

      Manual test 03: backup/restore course

      1. Login as admin
      2. Backup the course with all activities and sections
      3. Restore the mbz file as a new course
      4. Access the new course and turn editing ON
      5. Check: the following activities must have restriction access to "Not available unless: The activity Page1 is marked complete"
        1. Page2, Page3
        2. 2nd section, 3rd section

       

      Show
      Most use cases have acceptance test implemented: PHPUnitTest : vendor/bin/phpunit my/tests/filename.php  availability/condition/completion/tests/condition_test.php behat : vendor/bin/behat - -config DATAPATH/moodledata_behat/behatrun/behat/behat.yml --tags= @availability_completion But there are 3 uses cases that need some manual testing. Test pre-requisites Create a course with a user enrolled as editing teacher Generate this course structure: Topic/Week 1 Activity Page1 : a mod_page with manual completion Topic/Week 2 : change the name to "2nd section" and add a restrict access "activity completion" to the section configured as "Previous activity with completion" and "must be marked completed" Activity Page2 : a mod page with manual completion restrict access "activity completion" configured as "Previous activity with completion" and "must be marked completed" Topic/Week 3:  change the name to "3rd section" and add a restrict access "activity completion" to the section configured as "Previous activity with completion" and "must be marked completed" Activity Page3 : a mod page with manual completion restrict access "activity completion" configured as "Previous activity with completion" and "must be marked completed" Topic/Week 4 : empty Log in as the enrolled teacher user Access the course Manual test 01: move activity Check : Page2 restriction should be "Not available unless: The activity Page1 is marked complete" Check : Page3 restriction should be  "Not available unless: The activity Page2 is marked complete" Turn on editing Check : Page2 restriction should be "Not available unless: The previous activity with completion is marked complete" Check : Page3 restriction should be  "Not available unless: The previous activity with completion is marked complete" Move Page2 activity to section/week 4 Turn off editing Check : Page2 restriction should be "Not available unless: The activity Page3 is marked complete" Check : Page3 restriction should be  "Not available unless: The activity Page1 is marked complete" Turn editing ON again and move back Page2 to section/week 2 before continuing the test Turn editing OFF Manual test 02: move section Check : 2nd section restriction should be "Not available unless: The activity Page1 is marked complete" Check : 3rd section restriction should be  "Not available unless: The activity Page2 is marked complete" Turn on editing Check : 2nd section restriction should be "Not available unless: The previous activity with completion is marked complete" Check : 3rd section restriction should be  "Not available unless: The previous activity with completion is marked complete" Move Topic/Week 2 section after section/week 3 Turn off editing Check : The old 2nd section restriction should be "Not available unless: The activity Page3 is marked complete" Check : 3rd section restriction should be  "Not available unless: The activity Page1 is marked complete" Manual test 03: backup/restore course Login as admin Backup the course with all activities and sections Restore the mbz file as a new course Access the new course and turn editing ON Check : the following activities must have restriction access to "Not available unless: The activity Page1 is marked complete" Page2, Page3 2nd section, 3rd section  
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-67613-master
    • Sprint:
      Moodle 3.9 - Moppies Kanban

      Description

      When a teachers defines a completion access restriction to a section or activity, they have to indicate a specific activity, and if they made any changes to the course structure they have to modify manually all the dependencies again. Instead, this patch adds a new option to the availability completion activity menu called "Previous activity with completion" which is a relative reference.

      This way, they could move the activity freely and access condition points always on the previous activity with completion enabled. Now a teacher could modify a simple sequential course without changing all the dependencies.

       

      When editing, the availability condition just show the previous activity name to avoid problems with the dynamic course edition:

      But when the user is not in editing mode the access restriction is calculated on the fly:

      For the student is the same as if the teacher just use the regular availability_completion options.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tusefomal Ferran Recio
              Reporter:
              tusefomal Ferran Recio
              Peer reviewer:
              Sara Arjona (@sarjona)
              Integrator:
              Adrian Greeve
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jun/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 1 hour, 41 minutes
                  4d 1h 41m