Moodle

Forum ratings not working

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.8.2
  • Fix Version/s: None
  • Component/s: Forum
  • Labels:
    None
  • Environment:
    Windows 2003 Server, Apache 2.0.59, MySQL 5.0.18, PHP 5.1.1
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE

Description

After clicking the "Send in my latest ratings" button Moodle returns and error: "Could not insert a new rating (0 = 392)"
The error occurs in every forum type and with every grade type. The error message is the same.
RSS, blocking or groups are not used.

With debugging switched on, error is:

Out of range value adjusted for column 'rating' at row 1

INSERT INTO mdl_forum_ratings ( USERID, POST, TIME, RATING ) VALUES ( 6, 0, 1191415066, 392 )

  • line 1425 of lib\dmllib.php: call to debugging()
  • line 68 of mod\forum\rate.php: call to insert_record()

Had this problem with 1.7+ too, thought upgrading might fix it. Alas
Hope you don't mind me prioritising this as Major, it's a really useful function.

Issue Links

Activity

Hide
John Isner added a comment -

Now that moodle.org is using 1.9 beta, I see that forum ratings are also not working. However instead of giving an error message, ratings fail silently. That is, after clicking "send in my latest ratings" the page redisplays but the rating (the blue ratings hyperlink) is not shown.

Show
John Isner added a comment - Now that moodle.org is using 1.9 beta, I see that forum ratings are also not working. However instead of giving an error message, ratings fail silently. That is, after clicking "send in my latest ratings" the page redisplays but the rating (the blue ratings hyperlink) is not shown.
Hide
Eric Eberhardt added a comment -

the last else is getting fired wrong sometimes...
to fix this, in the forum/rate.php change the last else to else if like this...

else

if ($postid != 0) { //this used to be just an else line

unset($newrating);
$newrating->userid = $USER->id;
$newrating->time = time();
$newrating->post = $postid;
$newrating->rating = $rating;

Show
Eric Eberhardt added a comment - the last else is getting fired wrong sometimes... to fix this, in the forum/rate.php change the last else to else if like this... else if ($postid != 0) { //this used to be just an else line unset($newrating); $newrating->userid = $USER->id; $newrating->time = time(); $newrating->post = $postid; $newrating->rating = $rating;
Hide
Gavin Stokes added a comment -

FWIW, I managed to fix this by comparing tables with a Moodle install that didn't have the problem.
Noticed some differences and discovered that changing datatypes as follows fixed the problem:
id - BIGINT(10)
userid - BIGINT(10)
post - BIGINT(10)
time - BIGINT(10)
rating - SMALLINT(4)

Not sure why they were wrong in the first instance, but changing them to match a 1.8.4+ install which was working OK has solved the problem.
After a server crash and restore I had to redo this hack to get them working again so I'm pretty sure this was it.

Cheers!

Show
Gavin Stokes added a comment - FWIW, I managed to fix this by comparing tables with a Moodle install that didn't have the problem. Noticed some differences and discovered that changing datatypes as follows fixed the problem: id - BIGINT(10) userid - BIGINT(10) post - BIGINT(10) time - BIGINT(10) rating - SMALLINT(4) Not sure why they were wrong in the first instance, but changing them to match a 1.8.4+ install which was working OK has solved the problem. After a server crash and restore I had to redo this hack to get them working again so I'm pretty sure this was it. Cheers!
Hide
Helen Foster added a comment -

Just tested forum ratings in the latest 1.8.7 and 1.9.3 - all working fine. Please reopen if the issue re-occurs.

Show
Helen Foster added a comment - Just tested forum ratings in the latest 1.8.7 and 1.9.3 - all working fine. Please reopen if the issue re-occurs.
Hide
Sean Keogh added a comment -

just as an update, replacing it with an earlier version from a 1.8 release:

rate.php,v 1.22 2006-10-23 03:29:54

seems to have fixed the problem...although of course I do not know what other problems that might introduce...

Sean K

Show
Sean Keogh added a comment - just as an update, replacing it with an earlier version from a 1.8 release: rate.php,v 1.22 2006-10-23 03:29:54 seems to have fixed the problem...although of course I do not know what other problems that might introduce... Sean K

People

Vote (3)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: