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

Recent course activity page outputs an error when filtering by group

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.0.9, 2.1.6, 2.2.3
    • Component/s: Course
    • Labels:
      None
    • Testing Instructions:
      Hide

      Testing difficulty: easy

      Follow the steps to reproduce provided by the reporter:

      1. Have a course with some groups and the workshop included
      2. Visit the recent course activity page and filter by group
      3. TEST: Make sure no SQL exception is thrown

      Show
      Testing difficulty: easy Follow the steps to reproduce provided by the reporter: 1. Have a course with some groups and the workshop included 2. Visit the recent course activity page and filter by group 3. TEST: Make sure no SQL exception is thrown
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32718-sql-typo

      Description

      Recent course activity page outputs the following error when filtering by group

      Debug info: Unknown column 'authorgroumembership.userid' in 'on clause'
      SELECT s.id AS submissionid, s.title AS submissiontitle, s.timemodified AS submissionmodified,
      author.id AS authorid, author.lastname AS authorlastname, author.firstname AS authorfirstname,
      author.picture AS authorpicture, author.imagealt AS authorimagealt, author.email AS authoremail,
      a.id AS assessmentid, a.timemodified AS assessmentmodified,
      reviewer.id AS reviewerid, reviewer.lastname AS reviewerlastname, reviewer.firstname AS reviewerfirstname,
      reviewer.picture AS reviewerpicture, reviewer.imagealt AS reviewerimagealt, reviewer.email AS revieweremail
      FROM mdl_workshop_submissions s
      INNER JOIN mdl_workshop w ON s.workshopid = w.id
      INNER JOIN mdl_user author ON s.authorid = author.id
      LEFT JOIN mdl_workshop_assessments a ON a.submissionid = s.id
      LEFT JOIN mdl_user reviewer ON a.reviewerid = reviewer.id
      LEFT JOIN mdl_groups_members authorgroupmembership ON authorgroumembership.userid = author.id
      LEFT JOIN mdl_groups_members reviewergroupmembership ON reviewergroumembership.userid = reviewer.id
      WHERE w.id = ?
      AND s.example = 0
      AND (authorgroupmembership.groupid = ? OR reviewergroupmembership.groupid = ?)
      AND (s.timemodified > ? OR a.timemodified > ?)
      ORDER BY s.timemodified ASC, a.timemodified ASC
      [array (
      0 => '1',
      1 => '2',
      2 => '2',
      3 => 830834400,
      4 => 830834400,
      )]
      Stack trace:

      line 413 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 829 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 618 of /mod/workshop/lib.php: call to mysqli_native_moodle_database->get_recordset_sql()
      line 176 of /course/recent.php: call to workshop_get_recent_mod_activity()

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          looks like a workshop trouble, reassigning

          Show
          skodak Petr Skoda added a comment - looks like a workshop trouble, reassigning
          Hide
          mudrd8mz David Mudrak added a comment -

          Thanks Jason for spotting this. Submitting for integration.

          Show
          mudrd8mz David Mudrak added a comment - Thanks Jason for spotting this. Submitting for integration.
          Hide
          poltawski Dan Poltawski added a comment -

          Integrated to master, 22, 21 and even 20 since David provided a branch and the fix is trivial.

          thanks!

          Show
          poltawski Dan Poltawski added a comment - Integrated to master, 22, 21 and even 20 since David provided a branch and the fix is trivial. thanks!
          Hide
          fred Frédéric Massart added a comment -

          The test failed because of another typo.
          Here is a patch that fixes it.

          https://github.com/FMCorz/moodle/commit/748b33e4b366b5fb49671ab014bb11be4557a374

          Show
          fred Frédéric Massart added a comment - The test failed because of another typo. Here is a patch that fixes it. https://github.com/FMCorz/moodle/commit/748b33e4b366b5fb49671ab014bb11be4557a374
          Hide
          poltawski Dan Poltawski added a comment -

          Thanks Frédéric, i've cherry-picked your fix to all branches.

          Could this be tested again.

          David - I assume you agree this was a sensible fix

          Show
          poltawski Dan Poltawski added a comment - Thanks Frédéric, i've cherry-picked your fix to all branches. Could this be tested again. David - I assume you agree this was a sensible fix
          Hide
          mudrd8mz David Mudrak added a comment -

          Gosh! Thanks Fred for spotting this and the patch! Now I am really ashamed as I used to blame other developers for being too lazy to at least try and execute the code after fixing it. Next time, unit test to be attached.

          Show
          mudrd8mz David Mudrak added a comment - Gosh! Thanks Fred for spotting this and the patch! Now I am really ashamed as I used to blame other developers for being too lazy to at least try and execute the code after fixing it. Next time, unit test to be attached.
          Hide
          fred Frédéric Massart added a comment -

          There you go, it's all good now. Successfully tested on 2.0, 2.1, 2.2 and master.

          Show
          fred Frédéric Massart added a comment - There you go, it's all good now. Successfully tested on 2.0, 2.1, 2.2 and master.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome?

          Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U

          Closing, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome? Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/May/12