Moodle
  1. Moodle
  2. MDL-32718

Recent course activity page outputs an error when filtering by group

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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
    • Rank:
      39672

      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()

        Activity

        Hide
        Petr Škoda added a comment -

        looks like a workshop trouble, reassigning

        Show
        Petr Škoda added a comment - looks like a workshop trouble, reassigning
        Hide
        David Mudrak added a comment -

        Thanks Jason for spotting this. Submitting for integration.

        Show
        David Mudrak added a comment - Thanks Jason for spotting this. Submitting for integration.
        Hide
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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: