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

forum_get_participants references a non-existent table

    Details

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

      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.

        Gliffy Diagrams

          Activity

          Hide
          andyjdavis 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
          andyjdavis 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
          andyjdavis 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
          andyjdavis 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
          samhemelryk Sam Hemelryk added a comment -

          Looks good to me thanks Andrew

          Show
          samhemelryk Sam Hemelryk added a comment - Looks good to me thanks Andrew
          Hide
          stronk7 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
          stronk7 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
          salvetore Michael de Raadt added a comment -

          Test result: test passed. Thanks Andrew.

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

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

          Ciao

          Show
          stronk7 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:
                Fix Release Date:
                10/Oct/11