Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-1316

Some course addons are shown twice sometimes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 2.6
    • 2.6
    • Courses

    Description

      The function $mmCoursesDelegate#updateNavHandlersForCourse is called twice per course when the user logins or starts the app: once for login event, and once when the site data is updated. This function empties the course handlers array and fills it again with the enabled addons.

      In some addons, the call isEnabledForCourse is asynchronous (grades, course completion), and sometimes the following case happens:

      1. Login event, updateNavHandlers starts. Empty courseHandlers.
      2. Synchronous addons are added to the list, asynchronous ones are waiting for a response.
      3. The site data is updated, so updateNavHandlers starts again. courseHandlers is emptied now.
      4. Synchronous addons are added to the list, asynchronous ones are waiting for a response.
      5. The first call of asynchronous addons ends, so they're added to courseHandlers.
      6. The second call of asynchronous addons ends, so they're added to courseHandlers again.

      With some changes in code this can be reproduced 100% of times:

      1. Modify $mmaGrades#isPluginEnabledForCourse and add a timeout in there to make it slower. I used a 1 second timeout.
      2. Modify $mmCoursesDelegate#updateNavHandler and add a timeout too. I used 1 second too.

      With these 2 changes I always see the grades plugin 2-3 times.

      Attachments

        Activity

          People

            dpalou Dani Palou
            dpalou Dani Palou
            Juan Leyva Juan Leyva
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Clockify

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