Moodle
  1. Moodle
  2. MDL-29902

Course search results in debugging notice

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.2
    • Component/s: Course
    • Labels:
      None
    • Database:
      Any
    • Testing Instructions:
      Hide

      SETUP:
      1/ Create a course named 'test'
      2/ Enrol a test user as a teacher, also add the 'non editting teacher' role to them at course context
      3/ Go to Admin -> Appearance -> Course contacts and select 'non editing teacher' in addition to 'teacher'

      TEST A:
      Run the course search for 'test'
      TEST B:
      View the category which course 'test' is displayed in.

      EXPECTED RESULT
      The course is displayed with the test user listed as a course contact, displaying the role

      ACTUAL RESULT

      The course is displayed fine with the user displayed in TEST B, but in TEST A:

      Did you remember to make the first column something unique in your call to get_records? Duplicate value '3' found in column 'id'.
      line 705 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
      line 5257 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql()
      line 2447 of /course/lib.php: call to get_role_users()
      line 232 of /course/search.php: call to print_course()

      Show
      SETUP: 1/ Create a course named 'test' 2/ Enrol a test user as a teacher, also add the 'non editting teacher' role to them at course context 3/ Go to Admin -> Appearance -> Course contacts and select 'non editing teacher' in addition to 'teacher' TEST A: Run the course search for 'test' TEST B: View the category which course 'test' is displayed in. EXPECTED RESULT The course is displayed with the test user listed as a course contact, displaying the role ACTUAL RESULT The course is displayed fine with the user displayed in TEST B, but in TEST A: Did you remember to make the first column something unique in your call to get_records? Duplicate value '3' found in column 'id'. line 705 of /lib/dml/pgsql_native_moodle_database.php: call to debugging() line 5257 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql() line 2447 of /course/lib.php: call to get_role_users() line 232 of /course/search.php: call to print_course()
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      19434

      Description

      If a user has two 'coursecontact' roles assigned at course context, the course search results in a debugging notice. Due to MDL-22309

        Issue Links

          Activity

          Hide
          Dan Poltawski added a comment -

          I have fixed this by cleaning up the code which displays the course description and roles so that:

          a) get_role_users is called with the right arguments to not cause debug notice (see MDL-22309 for root cause)

          and

          b) The course search and course listing use the same logic to display the same info rather than duplicating code and having slightly different behaviour.

          Due to the fact I have re factored a bit with b) I am targeting 2.2 only. This bug doesn't actually cause any problems so I don't think its worth backporting.

          Show
          Dan Poltawski added a comment - I have fixed this by cleaning up the code which displays the course description and roles so that: a) get_role_users is called with the right arguments to not cause debug notice (see MDL-22309 for root cause) and b) The course search and course listing use the same logic to display the same info rather than duplicating code and having slightly different behaviour. Due to the fact I have re factored a bit with b) I am targeting 2.2 only. This bug doesn't actually cause any problems so I don't think its worth backporting.
          Hide
          Sam Hemelryk added a comment -

          Thanks Dan - this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Dan - this has been integrated now
          Hide
          Ankit Agarwal added a comment -

          works = test passed!
          Cheers

          Show
          Ankit Agarwal added a comment - works = test passed! Cheers
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Done, your delicious hacks have been sent upstream, many thanks!

          Closing as fixed, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Done, your delicious hacks have been sent upstream, many thanks! Closing as fixed, ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: