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

Unable to delete rating in glossary module

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Glossary, Ratings
    • Labels:
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      While testing MDL-26272, trying to delete one rating from the drop-down (ajax alternative, select "Rate...") seems to wok ok for forum and database ratings, but in glossary I get:

      Unable to parse JSON string <br />
      <font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
      <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined variable: rating in /Users/stronk7/git_moodle/integration/rating/rate_ajax.php on line <i>144</i></th></tr>
      <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
      <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
      <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0001</td><td bgcolor='#eeeeec' align='right'>94720</td><td bgcolor='#eeeeec'>

      {main}( )</td><td title='/Users/stronk7/git_moodle/integration/rating/rate_ajax.php' bgcolor='#eeeeec'>../rate_ajax.php<b>:</b>0</td></tr>
      </table></font>
      <br />
      <font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
      <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Trying to get property of non-object in /Users/stronk7/git_moodle/integration/rating/rate_ajax.php on line <i>144</i></th></tr>
      <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
      <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
      <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0001</td><td bgcolor='#eeeeec' align='right'>94720</td><td bgcolor='#eeeeec'>{main}

      ( )</td><td title='/Users/stronk7/git_moodle/integration/rating/rate_ajax.php' bgcolor='#eeeeec'>../rate_ajax.php<b>:</b>0</td></tr>
      </table></font>

      {"success":true,"aggregate":5,"count":"1","itemid":68}

        Gliffy Diagrams

          Activity

          Hide
          andyjdavis Andrew Davis added a comment -

          Ive got code in my repo that fixes this for next sprint.

          repo: git://github.com/andyjdavis/moodle.git
          branch: MDL-26274_rating_delete
          diff: https://github.com/andyjdavis/moodle/compare/master...MDL-26274_rating_delete

          The problem wasnt the glossary as all rating code is common to all the activities. The issue would occur whenever a user removed their rating from an item that had at least one rating from another user.

          To test:
          As another user rate a glossary item, forum post or database entry.
          As your main user rate the item and check that the aggregate is updated correctly.
          Now select "Rate..." to delete your rating. Check that the aggregate is again updated correctly.

          Show
          andyjdavis Andrew Davis added a comment - Ive got code in my repo that fixes this for next sprint. repo: git://github.com/andyjdavis/moodle.git branch: MDL-26274 _rating_delete diff: https://github.com/andyjdavis/moodle/compare/master...MDL-26274_rating_delete The problem wasnt the glossary as all rating code is common to all the activities. The issue would occur whenever a user removed their rating from an item that had at least one rating from another user. To test: As another user rate a glossary item, forum post or database entry. As your main user rate the item and check that the aggregate is updated correctly. Now select "Rate..." to delete your rating. Check that the aggregate is again updated correctly.
          Hide
          skodak Petr Skoda added a comment -

          Hello, after testing it I have created a pull request for your github branch because next monday is the last PULL week before the 2.0.2 release, thanks a lot.

          Show
          skodak Petr Skoda added a comment - Hello, after testing it I have created a pull request for your github branch because next monday is the last PULL week before the 2.0.2 release, thanks a lot.
          Hide
          tsala Helen Foster added a comment -

          Thanks everyone.

          Show
          tsala Helen Foster added a comment - Thanks everyone.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Feb/11