user review and views problems

jwilde - April 30, 2007 - 17:10
Project:userreview
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:patch (code needs review)
Description

Hi,

I'm using 5.x, cck, views, votingapi and userreviews to create those interesting pages mentioned in the docs. But, none of them work. I get errors like this:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':video_points_count ON node.nid = votingapi_cache_userreview:video_points_count.' at line 1 query: SELECT count(node.nid) FROM node node INNER JOIN users users ON node.uid = users.uid LEFT JOIN userreview userreview ON node.nid = userreview.nid LEFT JOIN votingapi_cache votingapi_cache_userreview:video_points_count ON node.nid = votingapi_cache_userreview:video_points_count.content_id AND votingapi_cache_userreview:video_points_count.content_type = 'node' AND votingapi_cache_userreview:video_points_count.value_type = 'points' AND votingapi_cache_userreview:video_points_count.tag = 'userreview:video' AND votingapi_cache_userreview:video_points_count.function = 'count' WHERE (node.type IN ('video')) in

Thses errors are from views when I have VotingAPI points userreview:video result (count) selected in the fields. If I use Userreview: Vote Value I get blanks even if there is a review. Any ideas?

Thanks,

Jim

#1

Sophia - May 3, 2007 - 22:32

I am getting the exact same error message Jim, but only when I create a view of the reviewed games and try to add the average score to it. Don't know how to solve it... tried everything but I either get nothing, or an error message!

#2

JacobSingh - May 16, 2007 - 18:58
Status:active» patch (code needs review)

I think this is because of the : used in the votingapi tag. Here is a patch that might fix it.

AttachmentSize
userreview_changed_tag.patch896 bytes

#3

JacobSingh - May 16, 2007 - 20:05

Whoops, I found the right problem, but wrong solution. Try this path. Needed to use _ not -, because - is also not okay for mysql table names.

AttachmentSize
userreview_changed_tag_0.patch1.83 KB

#4

nobody1225 - May 18, 2007 - 13:29

sorry! I have the same problem.
I used this patch , but is the same problem!

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':read99_percent_average ON node.nid = votingapi_cache_userreview:read99_percent_' at line 1 query: SELECT count(DISTINCT(node.nid)) FROM node node LEFT JOIN content_type_read99 node_data_field__42 ON node.vid = node_data_field__42.vid LEFT JOIN content_type_read99 node_data_field__34 ON node.vid = node_data_field__34.vid LEFT JOIN content_type_read99 node_data_field__35 ON node.vid = node_data_field__35.vid LEFT JOIN votingapi_cache votingapi_cache_userreview:read99_percent_average ON node.nid = votingapi_cache_userreview:read99_percent_average.content_id AND votingapi_cache_userreview:read99_percent_average.content_type = 'node' AND votingapi_cache_userreview:read99_percent_average.value_type = 'percent' AND votingapi_cache_userreview:read99_percent_average.tag = 'userreview:read99' AND votingapi_cache_userreview:read99_percent_average.function = 'average' WHERE (node.status = '1') AND (node.type IN ('read99')) in D:\AppServ\www\lib\includes\database.mysql.inc on line 172.

please help!
thanks!

#5

nobody1225 - May 20, 2007 - 14:10

sorry!
today ,i try this patch again , it is ok.
what's wrong , i don't know.
but thank you very much.

#6

Paintbox - June 26, 2007 - 10:11

When I apply this manually --don't have no CVS software-- (Could someone attach the complete module??) I change only two lines right?

Because when I change these two lines from : to _ , I don't get no userreview output anymore on my node...nothing...

Any official patch on the horizon? Otherwise I have to look at writing a custom PHP <> SQL function in my template, which I rather not do (This module is a bit over my head PHP-wise)

#7

gerd riesselmann - June 26, 2007 - 11:25

Sorry for the late reply, but I have been really, really busy the last months.

I tried to reproduce the problem, but did not manage to. Can you please tell me more about how exactly you configured your views? That is: What are the filters, what are the sort criteria, what are the fields, and what are the arguments?

Regarding the ":", it looks like a bug in views module, which should be able to build valid table synonyms if it decided to use them ;-)

#8

gerd riesselmann - June 26, 2007 - 11:48

I just realized that voting api's views integration has gotten a major overhaul. Fields like "Voting API: percent userreview:[type] value" were not available when I moved to 5.0. I will have a look at this.

In the meantime, try to build views like it was done in the old days, using "Voting API: Result function", like described here: http://drupal.org/node/148357

#9

gerd riesselmann - June 27, 2007 - 10:55

A note: The proposed patch leads to all recent votes becoming invalid, since the tag stored in DB doesn't match the tag created in code. If you apply the patch, please update your DB accordingly:

UPDATE votingapi_cache SET tag = 'userreview_[YOUR NODE TYPE]' WHERE tag = 'userreview:[YOUR NODE TYPE]';
UPDATE votingapi_vote SET tag = 'userreview_[YOUR NODE TYPE]' WHERE tag = 'userreview:[YOUR NODE TYPE]';

#10

gerd riesselmann - June 27, 2007 - 11:54

The core of this problem is votingapi_views.inc. I created a patch, and passed the ball: http://drupal.org/node/154995.

#11

Paintbox - June 30, 2007 - 07:29

Thank you very much for looking into this Gerd, I will be trying this out ASAP, probably in the run of the week. With the info you gave I should be able to figure something out.

#12

nicholas_w - September 6, 2007 - 13:20

The colons are still in the most recent download of this module, so this problem will still occur for new users -- though the latest dev branch of the votingapi has fixed its part of the bug.

It's an easy thing to fix, but may I suggest that the patch needs to be committed to the module to save new users this trouble.

#13

royal007 - September 25, 2007 - 19:35

i am having the exact same problem

if i use the "VotingAPI percent userreview:review value" in views it shows the vote, but if the node has several votes, the view shows the same title over and over with the other votes next to them.

Title:.....................Vote:
Finding Nemo ............9
Finding Nemo ............7
Finding Nemo ............9
Finding Nemo ............8

I want them to be like

Title: .....................Vote:
Finding Nemo ............8.5 (this being the average of all votes)

I think the one to select is "VotingAPI percent userreview:review result (average)" but when I do so, I get this error.

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':review_percent_average ON node.nid = votingapi_cache_userreview:review_pe' at line 1 query: SELECT count(node.nid) FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy term_hierarchy ON term_node.tid = term_hierarchy.tid LEFT JOIN votingapi_vote votingapi_vote_userreview_review_percent ON node.nid = votingapi_vote_userreview_review_percent.content_id AND votingapi_vote_userreview_review_percent.content_type = 'node' AND votingapi_vote_userreview_review_percent.value_type = 'percent' AND votingapi_vote_userreview_review_percent.tag = 'userreview:review' LEFT JOIN votingapi_cache votingapi_cache_userreview:review_percent_average ON node.nid = votingapi_cache_userreview:review_percent_average.content_id AND votingapi_cache_userreview:review_percent_average.content_t in /home/content/g/a/m/html/includes/database.mysql.inc on line 172.

any idea how to fix this??, I tried what someone mentioned above but it did not work.

#14

royal007 - October 1, 2007 - 14:53

nevermind.....got it fixed

 
 

Drupal is a registered trademark of Dries Buytaert.