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

Course editor can trigger multiple activity reloads in a single action

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-77677-master
    • Hide
      1. Login as admin and go to "Site Administration -> Advanced features" and enable"Allow stealth activities" (allowstealth).
      2. Create a topics format course with 1 activity in topic1 and 3 activities in topic 2
      3. Open the browser network monitor and filter connections by "fragment" text.
      4. Clean the network monitor
      5. Hide the activity in topic1
      6. Check that the monitor shows one new "fragment" connection
      7. Clean the network monitor
      8. Now "Make available" (stealth) the section 1 activity
      9. Check: that one new fragment connection is added to the network monitor
      10. Clean the network monitor
      11. Hide section2
      12. Check: that 3 new fragment connection is added to the network monitor
      Show
      Login as admin and go to "Site Administration -> Advanced features" and enable"Allow stealth activities" (allowstealth). Create a topics format course with 1 activity in topic1 and 3 activities in topic 2 Open the browser network monitor and filter connections by "fragment" text. Clean the network monitor Hide the activity in topic1 Check that the monitor shows one new "fragment" connection Clean the network monitor Now "Make available" (stealth) the section 1 activity Check : that one new fragment connection is added to the network monitor Clean the network monitor Hide section2 Check : that 3 new fragment connection is added to the network monitor
    • HQ 2023 Sprint i1.3 Moppies

      Since 4.2 the course/format/amd/src/local/content.js has 4 actions that trigger a _reloadCMmmethod:

      • Changing visible attribute
      • Changing stealth attribute
      • Changing activity sectionid
      • Changing activity indentation

      In some scenarios, a user action can do more than one change, and the _reloadCm is executed twice. This is not a big problem, but it is completely unnecessary.

      How to reproduce it in Moodle 4.2:

      1. Enable stealth activities
      2. Go to a topics format course with some activities
      3. Open the browser network monitor and filter connections by "fragment" text
      4. Hide one activity
      5. Check that the monitor shows one new "fragment" connection
      6. Now make available (stealth) the activity
      7. Expected: a new "fragment" connection should appear
      8. What happens: 2 new "fragment" connections appear, one from the visible attribute and one from the stealth.

      Technical shaping

      The content._reloadCm method is defined as various watchers in the "getWatcher" method. This is the reason why it is triggered several times. In this case, all cm refresh is centralised in a single method. This complicates the debouncing process because each CM could be refreshed simultaneously, for example, when updated section visibility.

      The _reloadCm should use a map of debounced refresh methods to prevent executing unnecessary calls to fragment. One per each CM id.

       

        1. MDL-77677.png
          323 kB
          Ron Carl Alfon Yu

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Laurent David Laurent David
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 7 minutes
                3h 7m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.