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

New Setting: Allow for duplicates in the list of coursecontacts

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.6
    • 3.4, 3.5
    • Course
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_36_STABLE
    • MDL-60710-master
    • Hide
      • Create 4 users: u0, u1, u2, u3 (You can upload users with the attached MDL-60710-user-upload.txt file here
      • On page "site administration / Apperance / Course": 
        • Select roles Manager, Teacher (role shortname: editingteacher), and Non-editing teacher (role shortname: teacher) as coursecontact roles
        • Ensure the new setting 'coursecontactduplicates' is disabled.  
      • On page "site administration / users /define roles":
        • Ensure that role Manager is placed above role Teacher (role shortname: editingteacher) and role Teacher (role shortname: editingteacher) is placed above Non-editing teacher (role shortname: teacher)
      • Create:
        • a new top-level category A
        • and add a new course C to category A.
      • Assign role manager to users u0, u1 and u2 in category A
      • Enrol user u1 as Manager, u2 as Teacher, and user u3 as Non-editing teacher in course C.
      • When you view category A, the coursecontacts of course C should be:
        • Manager: u1, u2
        • Non-editing teacher: u3
      • On page "site administration / Apperance / Course":
        • Now activate the new setting  'coursecontactduplicates'
      • Purge all caches 
      • When you view category A, the coursecontacts of course C should be:
        • Manager: u1
        • Manager, Teacher: u2
        • Non-editing teacher: u3

       

       

      Show
      Create 4 users: u0, u1, u2, u3 (You can upload users with the attached MDL-60710 -user-upload.txt file here On page "site administration / Apperance / Course":  Select roles Manager, Teacher (role shortname: editingteacher), and Non-editing teacher (role shortname: teacher) as coursecontact roles Ensure the new setting 'coursecontactduplicates' is disabled.   On page "site administration / users /define roles": Ensure that role Manager is placed above role Teacher (role shortname: editingteacher) and role Teacher (role shortname: editingteacher) is placed above Non-editing teacher (role shortname: teacher) Create: a new top-level category A and add a new course C to category A. Assign role manager to users u0, u1 and u2 in category A Enrol user u1 as Manager, u2 as Teacher, and user u3 as Non-editing teacher in course C. When you view category A, the coursecontacts of course C should be: Manager: u1, u2 Non-editing teacher: u3 On page "site administration / Apperance / Course": Now activate the new setting  'coursecontactduplicates' Purge all caches  When you view category A, the coursecontacts of course C should be: Manager: u1 Manager, Teacher: u2 Non-editing teacher: u3    

      If a teacher has two of the roles that are shown in the lists of coursecontacts, she/he is only shown once in the coursecontacts with only one of these roles. However, there are cases in which it might be desired to show duplicates, e.g., if examiners should be highlighted or if there is one main contact among the teachers being responsible for a course and this fact is highlighted by a respective role that is additionally assigned to the teacher. 

      The reason for showing only one role is located in lib/coursecatlib.php#2860 function get_course_contacts that filters out duplicates among the coursecontacts. 

      To enable administrators to choose themselves whether duplicates are hidden or displayed, we prepared a small patch:

      • added a setting on "Site administration > Appearance > Courses" that allows disabling the elimination of duplicates among coursecontacts
      • Prepared an adapted version of function get_course_contacts adding an optional parameter $showduplicates (default false).
        • Still duplicate role assignment to the same user have to be eliminated nevertheless (e.g., if role 'teacher' is assigned to a certain user in a category and she/he is enrolled as 'teacher' in a course of this category as well, then she/he should be listed only once as teacher)
        •   Ids of users can no longer be used as indices in the result, because the same user may occur more then once. This required some minor changes. 
      • Adapted all calls of get_course_contacts, thereby
        • In course/renderer.php we utilize the new setting so that duplicates may be filtered or not as desired by the introduced settings
        • In course/externallib.php we only added the parameter with value false (i.e., so that the behavior does not change much).
      • Additional automated Tests

        1. MDL-60710.PNG
          55 kB
          Anna Carissa Sadia
        2. MDL-60710-user-upload.txt
          0.2 kB
          Luca Bösch

            abias Alexander Bias
            davidknu David Knuplesch
            Luca Bösch Luca Bösch
            David Monllaó David Monllaó
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

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