Views fields appear and disappear

p_alexander - August 17, 2007 - 18:28
Project:Voting API
Version:5.x-1.5
Component:Code
Category:support request
Priority:critical
Assigned:Unassigned
Status:duplicate
Description

When using the Voting API module in views, the available fields appear and disappear for no apparent reason. This started happening on an existing install so I started a fresh one and am still getting the same problem. When creating/editing a view I will attempt to add a sort or filter field and the only available options are "VotingAPI Percent*" (lists about six). Views already created using VotingAPI Points* fields cause a MySQL error. Then randomly, again for now apparent reason, they will come back.

It looks as though Views gets this information from VotingAPI. If that's not true I will hit up the issue with the Views people.

Any ideas? Thanks!

#1

martig - August 19, 2007 - 13:12

I have the same kind of a problem. I don't see any VotingAPI points filters in views, only percent filters. I'm using the latest version of views.

#2

vrc3 - August 29, 2007 - 03:35

I'm having a similar issue which may have the same root cause though I'm seeing a different effect.

I have several views defined which create a table of nodes and have the average vote and the number of votes as two of the fields. If I edit or delete a view, even a completely unrelated one with no vote fields, each of the views with the vote fields then shows no nodes!!! It is very nervewracking to see your carefully laid out tables, much of the content of your site, suddenly disappear. I get an error such as this in my log

Unknown column 'votingapi_cache_vote_percent_average.value' in 'field list' query: SELECT node.nid, node.title AS node_title, node.changed AS node_changed, votingapi_cache_vote_percent_average.value AS votingapi_cache_vote_percent_average_value, votingapi_cache_vote_percent_count.value AS votingapi_cache_vote_percent_count_value FROM node node WHERE (node.type IN ('beer')) AND (node.status = '1') ORDER BY node_title ASC LIMIT 0, 50 in /usr/share/drupal/includes/database.mysql.inc on line 172.

I can restore my views by editing one, removing the votingapi fields and putting them back. I do this for ONE view and then they all come back.

#3

stevepurkiss - September 11, 2007 - 08:59
Priority:normal» critical

Mine disappeared an hour ago! All my views with voting fields in are now broken :(

I can't see *any* of the voting fields listed in views any more - has anyone had any luck sorting this out yet?

#4

stevepurkiss - September 11, 2007 - 09:09

OK, I too can see the fields again when I take them out of the view first. Wondering if this is being looked into as planning to put a site live in the next week or so and obviously don't want it to break horribly ;) Happy to help if I can btw, just point me in the right direction...

#5

stevepurkiss - September 11, 2007 - 13:54

I think I may have discovered something - instead of clicking "save" on views, click "save and edit" then use the breadcrumb link to get back to the views list. It doesn't seem to be breaking when I do that...

#6

bellumlagosi - September 15, 2007 - 13:17

Having the same issue, oddly the remedy of "save and edit" appears to work once I've uninstalled the voting api to clear a cache?

#7

stevepurkiss - September 18, 2007 - 20:57

I'm tellin ya man, save and edit works a treat. Until I discovered that little trick I was tearing my hair out, which is quite painful as I don't have any ;)

#8

westbywest - October 4, 2007 - 03:12

I have now twice observed the same problem with votingapi and views.

Relevant module/drupal data:
drupal v5.2
actions v5.x-1.x-dev (2007-May-02)
taxonomy access control v5.x-1.1
views v5.x-1.6
views bonus pack v5.x-1.2-alpha1
vote_up/down 5.x-1.x-dev (2007-Oct-02)
votingapi v5.x-1.5

I set up a list view, where one of the fields is the sum of votes cast.

As previous poster explains, the votingapi fields disappear from the view edit page after a period of time, as do relevant fields and filter options (i.e. votingapi and vote_up/down). When viewing the affected view after this happens, I observed this SQL error about a missing column in the DB:

Unknown column 'votingapi_cache_vote_percent_count.value' in 'field list' query: SELECT DISTINCT(node.nid), node.sticky AS node_sticky, node.created AS node_created_created, node.title AS node_title, node.changed AS node_changed, users.name AS users_name, users.uid AS users_uid, votingapi_cache_vote_percent_count.value AS votingapi_cache_vote_percent_count_value, votingapi_cache_vote_points_sum.value AS votingapi_cache_vote_points_sum_value FROM stlimc_node node LEFT JOIN stlimc_term_node term_node ON node.nid = term_node.nid LEFT JOIN stlimc_term_hierarchy term_hierarchy ON term_node.tid = term_hierarchy.tid INNER JOIN stlimc_users users ON node.uid = users.uid WHERE (node.type IN ('article','article_audio','article_image','article_video')) AND (term_node.tid IN ('43')) ORDER BY node_sticky DESC, node_created_created DESC LIMIT 0, 20 in /data/www/drupal/includes/database.mysql.inc on line 172.

Is there something broken with the votingapi cache mechanism? This could explain the error appearing only after some time has passed. Removing the (now blank) list field from the view does not restore the votingapi options in the view edit page.

However, clearing the cache (via devel module) restores the voteapi fields to the view edit page, albeit temporarily.

#9

westbywest - October 17, 2007 - 01:28

I think this is related to another bug with Voting API and views:
http://drupal.org/node/181585

I applied the patch suggested above and the DB errors went away (so far). I haven't yet checked whether this clears the "save and edit" work-around suggested above.

#10

trusche - October 23, 2007 - 13:56

Nope, that wasn't it, still gettting the same behaviour. However, I just noticed that in line 43 of votingapi_views.inc

'tag' => $tag,

the $tag variable is never initialized. I've only scanned the code so far but I strongly suspect this was intended to be

'tag' => $vote_tag,

Checking this theory now, wish me luck :)

#11

trusche - October 25, 2007 - 21:40

OK, that wasn't it... still having this issue. This is getting rather urgent for me and I'm stuck trying to troubleshoot it, being unfamiliar with the views module... all I can tell is that this query

SELECT DISTINCT(node.nid), votingapi_cache_vote_percent_average.value AS votingapi_cache_vote_percent_average_value, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_data term_data ON term_node.tid = term_data.tid WHERE (node.status = '1') AND (node.type IN ('unity_resource')) AND (term_data.name = 'education') LIMIT 0, 3

is missing a table votingapi_cache_vote_percent_average in the FROM list, but I haven't been able to figure out where this query is actually assembled... and while there is an entry for this table in the views_tablefield table, the table itself does not exist... not sure if it's supposed to be a temporary one?

So I guess what I'm really asking is if anyone is actually working on troubleshooting this. I'll gladly help but as I said I'm somewhat stuck right now.

Thanks!
Thilo

#12

raintonr - November 5, 2007 - 00:16

This is a probably a duplicate of this:

http://drupal.org/node/189311

The good news is I supplied a patch there :)

Can someone please take a look and confirm that patch fixes their issues? And if so mark this as a duplicate.

#13

freeStyle_Media - November 17, 2007 - 22:18

I applied the patch, and now nothing from votingapi shows up on my views pages. I even went as far as disabling votingapi, uninstalling it, sleeping on my decision, then after downloading it again i uploaded it, and still nothing on the views page at all. I hope there is a fix for this soon.

#14

raintonr - November 19, 2007 - 04:46

Hi freeStyle_Media,

That sounds very odd. Not that I mentioned it, but did you clear your cache* tables?

What versions of the modules are you using?

#15

rnagy - January 2, 2008 - 15:21

Add the following code before the first function declaration in votingapi.module:

if (module_exists('views')) {
  require_once(drupal_get_path('module', 'votingapi') .'/votingapi_views.inc');
}

This worked a treat for me.

Thanks to raintonr for the patch at:

http://drupal.org/node/189311

Cheers,
Robert Nagy

#16

tj2653 - January 15, 2008 - 20:10

I was having this problem too - but I thought I was the only one, so I figured out the "Save and Edit" trick through trial and error. I eventually ended up just removing the "Save" button altogether, as I would sometimes mistakenly click it, causing immediate errors. I will try out the patch in #189311 to see if it works for me. Thanks.

#17

dnorman - February 15, 2008 - 20:37

I'm seeing this, too. I'm using a view for the front page, and periodically it will stop working and throw a MySQL error thusly:

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 '> '20') ORDER BY node_created_created DESC LIMIT 0, 20' at line 1 query: SELECT DISTINCT(node.nid), node.created AS node_created_created FROM node node WHERE (node.status = '1') AND (.value > '20') ORDER BY node_created_created DESC LIMIT 0, 20 in /home/username/public_html/eduglu/includes/database.mysql.inc on line 172.

I just enabled the devel module, and clearing the cache makes the problem go away. But it comes back. The strange thing is that I'm not editing the view at all - it's already edited and saved, working for awhile, then borking seemingly just for something to do.

Any ideas? I'm presenting this site at a conference next week and it'll look a bit silly if I have to keep clearing cache to get the front page to work :-)

#18

dnorman - February 15, 2008 - 20:42

ah. just saw the clue to what's going on - it's the part of the query where it's trying to add in the field (in this case, it's trying to add VotingAPI percent vote value but for some reason isn't finding the table name so it's leaving it empty)

the query should read something like this:

SELECT node.nid, node.created AS node_created_created FROM {node} node LEFT JOIN {votingapi_vote} votingapi_vote_vote_percent ON node.nid = votingapi_vote_vote_percent.content_id AND votingapi_vote_vote_percent.content_type = 'node' AND votingapi_vote_vote_percent.value_type = 'percent' AND votingapi_vote_vote_percent.tag = 'vote' WHERE (node.status = '1') AND (votingapi_vote_vote_percent.value > 20) ORDER BY node_created_created DESC

#19

dnorman - February 15, 2008 - 20:49

Looks like this issue has been fixed by this: http://drupal.org/node/189311

#20

mkahn - April 23, 2008 - 03:27

I got this after adding a new content type, and a new field. I'm trying out workflow, and doing nothing related to votingAPI or views.

This error appears on my homepage, but not on sub-pages. deleting the new content type made it go away.

user warning: Unknown column 'votingapi_cache_vote_percent_average.value' in 'field list' query: SELECT DISTINCT(node.nid), node_data_field_time.field_time_value AS node_data_field_time_field_time_value, node_data_field_picture.field_picture_fid AS node_data_field_picture_field_picture_fid, node_data_field_picture.field_picture_title AS node_data_field_picture_field_picture_title, node_data_field_picture.field_picture_alt AS node_data_field_picture_field_picture_alt, node.title AS node_title, node.changed AS node_changed, votingapi_cache_vote_percent_average.value AS votingapi_cache_vote_percent_average_value, node.type FROM node node LEFT JOIN content_type_event node_data_field_time ON node.vid = node_data_field_time.vid LEFT JOIN content_type_resturant node_data_field_picture ON node.vid = node_data_field_picture.vid WHERE (node.status = '1') AND (node.type IN ('event')) ORDER BY node_data_field_time_field_time_value ASC LIMIT 0, 7 in /var/www/html/includes/database.mysql.inc on line 172.

#21

1.kenthomas - April 23, 2008 - 05:46

Pong.

#22

Harry Slaughter - April 24, 2008 - 05:49

subscribing

seeing same behavior

#23

raintonr - April 28, 2008 - 06:15
Status:active» duplicate

As many people have mentioned, this is duplicate of #189311: votingapi_views.inc included in wrong place.

 
 

Drupal is a registered trademark of Dries Buytaert.