Moodle
  1. Moodle
  2. MDL-27298

forum_get_participants references a non-existent table

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.5
    • Component/s: Forum
    • Labels:
      None
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      This code doesnt actually appear to be executed anywhere in Moodle so testing is hard. Just verify that the forums still work. Create a forum, post in it then reply to that post.

      Show
      This code doesnt actually appear to be executed anywhere in Moodle so testing is hard. Just verify that the forums still work. Create a forum, post in it then reply to that post.
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      16987

      Description

      The following query appears in the function forum_get_participants in /mod/forum/lib.php

      $st_ratings = $DB->get_records_sql("SELECT DISTINCT u.id, u.id
      FROM

      {user}

      u,

      {forum_discussions}

      d,

      {forum_posts}

      p,

      {ratings}

      r
      WHERE d.forum = ? AND
      p.discussion = d.id AND
      r.post = p.id AND
      u.id = r.userid", array($forumid));

      From what I can tell, the ratings table does not exist. There is a rating table, but it does not have a column named post.

        Activity

        Hide
        Andrew Davis added a comment -

        This has already been resolved in the 2.1 stable and master branches. It is still an issue in 2.0 stable.

        Most likely r.post just needs to be changed to r.itemid

        Show
        Andrew Davis added a comment - This has already been resolved in the 2.1 stable and master branches. It is still an issue in 2.0 stable. Most likely r.post just needs to be changed to r.itemid
        Hide
        Andrew Davis added a comment -

        Here is a fix. I also fixed up some SQL formatting. Im having trouble figuring out how to exercise this code from within Moodle. I'll need to figure that out to write the testing instructions.

        Note that this is 2.0 stable only.

        Show
        Andrew Davis added a comment - Here is a fix. I also fixed up some SQL formatting. Im having trouble figuring out how to exercise this code from within Moodle. I'll need to figure that out to write the testing instructions. Note that this is 2.0 stable only.
        Hide
        Sam Hemelryk added a comment -

        Looks good to me thanks Andrew

        Show
        Sam Hemelryk added a comment - Looks good to me thanks Andrew
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated, thanks!

        PS: Right now we don't have any use for all those xxx_get_participants() functions into core (they were used by 1.9 backup). Just guessing if there will be code out there using them or we should deprecate/delete them in upcoming versions.

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated, thanks! PS: Right now we don't have any use for all those xxx_get_participants() functions into core (they were used by 1.9 backup). Just guessing if there will be code out there using them or we should deprecate/delete them in upcoming versions.
        Hide
        Michael de Raadt added a comment -

        Test result: test passed. Thanks Andrew.

        Show
        Michael de Raadt added a comment - Test result: test passed. Thanks Andrew.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        And this code has been spread to all Moodle git and cvs repositories. Many thanks! Closing.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - And this code has been spread to all Moodle git and cvs repositories. Many thanks! Closing. Ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: