Jump to:
| Project: | Event Repeat Views |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
When I first select the "Event Repeat: Distinct Events" filter, and try to save, I get the error: "Event Repeat: Distinct Events must have a value!" The filter contains the operator "is" and the value "distinct", as created by default. If I try to save a second time, after selecting the value "distinct", the view saves, but I see the following error when trying to display the view:
user warning: Unknown column 'event_repeat.rid' in 'group statement' query: SELECT DISTINCT(node.nid), node_data_field_publication_date.field_publication_date_value AS node_data_field_publication_date_field_publication_date_value, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN content_field_expire_date node_data_field_expire_date ON node.vid = node_data_field_expire_date.vid LEFT JOIN content_field_publication_date node_data_field_publication_date ON node.vid = node_data_field_publication_date.vid WHERE (node.moderate = '0') AND ( REPLACE(node_data_field_expire_date.field_expire_date_value,'T',' ') >= NOW()) AND (node.status = '1') AND ( REPLACE(node_data_field_publication_date.field_publication_date_value,'T',' ') <= NOW()) AND (node.type IN ('event','story')) GROUP BY event_repeat.rid, node_data_field_publication_date_field_publication_date_value ORDER BY node_data_field_publication_date_field_publication_date_value DESC LIMIT 0, 10 in /var/www/html/users/wsbe/includes/database.mysql.inc on line 172.
Any suggestions?
Comments
#1
I have the same problem, any clues?
#2
Near as I can tell, the error is saying that the sql statement does not include a reference to the event_repeat table prior to its use in the group by clause.
But for the love of money I am not sure how and where to add it. I will try and parse this phrase to see what the heck are we trying to do here anyway.
If any other sql guru could help it would be greatly appreciated.
#3
Ai yi yi!
Okay, so I nailed the problem on the head. The distinct view handler does not seem to do enough, you have to do more than group them.
/** Set a query to be distinct as a filter handler
*/
function eventrepeat_views_handler_filter_distinctevent($op, $filter, $filterinfo, &$query) {
$query->add_groupby('event_repeat.rid');
}
All it adds is a group by clause. Has this ever worked?
I guess if you are selecting only repeating events it might work, but this will not integrate well with none repeating events ... let me test some more ... maybe it is assuming that you picked event repeat fields in the field section instead of the generic event fields.
#4
Okay there are two distinct problems here.
WHERE node.nid=event_repeat_nodes.nid AND event_repeat_nodes.rid=event_repeat.ridAnd it needs to add event_repeat and event_repeat_nodes to the table list.This is the cause of the error above. In order to not get the error, you have to use event repeat fields instead of event fields, i.e. use Event Repeat: First Session Time instead of Event: Start Time. But regular events do not have event repeat fields - so they will not appear.
I am at a loss on how to proceed at his point. Hopefully someone will step in who has better Form API brain cells than I.
#5
hi,
i think i solved the problem with this ugly hack for my situation.
in the file eventrepeat_views.module i replaced the function eventrepeat_views_handler_filter_distinctevent with the one below:
function eventrepeat_views_handler_filter_distinctevent($op, $filter, $filterinfo, &$query) {$query->ensure_table('event_repeat_nodes');
$query->add_groupby("substr(concat_ws('----------',event_repeat_nodes.rid,node.nid),1,10)");
}
don't forget to flush your view cache at Home » Administer » Site building » Views » Tools after making this edit!!!
sorry, i bet there is a more logic way to solve, but as i'm in a hurry...
#6
Hey! #5 actually works! Be sure to check for invisibles if you paste the new function directly in from above. You may get some parse errors otherwise. Maybe if lamojo could make this a patch ... ;-D
But since I still cannot mix repeatable events in the same list as regular events AND use distinct ... it did not solve my problem as discussed in #4 above.
However I did figure out a way to do it using taxonomy.
And chango presto ... my calendar only includes the first items from each set. I will have it live by Saturday, Dec 8 08 at www.reflectionsmyst.org . It is working on my sandbox at the moment. And yeah I have to monitor the view for future events just in case repeats start showing up again ... but hey it works for me, YMMV.
#7
subscribing