Download & Extend

Provide a "first event" view filter

Project:Event Repeat
Version:5.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

If you want to get a list of repeating events, normally you dont want to see anything but the first of those events - so you need something to filter to get "just" the first event.

Unfortunately it's not quite that easy because of the way the data is stored. The way I have achieved this is to join the event_repeat_nodes table, then join the even_repeat table, then add a when clause to check that the repeat data (which is serialized) has in it a string matching nid.... and the nid you are looking for. Still not as easy as that, as the nid value is sometimes stored as an int, and sometimes as a string. - Oh joy

  $query->add_where("LOCATE(CONCAT('s:3:\"nid\";i:', CAST(node.nid AS CHAR)),event_repeat.repeat_data) OR LOCATE(CONCAT('s:3:\"nid\";s:',CAST(LENGTH(CAST(node.nid AS CHAR)) AS CHAR),':\"', CAST(node.nid AS CHAR)),event_repeat.repeat_data)");

It works for me.

I haven't tried the patch on the 2.x branch yet - sorry.

AttachmentSize
eventrepeat.firstevent.patch1.6 KB

Comments

#1

Hi I would just like to say the functiobality this patch would add is great and I think it would be very usefull to loads of people including myself. The ability to filter event nodes by wither they are the first nodes, would be a great addition to this module, becouse it would solve the problem of not being able to limit the events shown on the frontpage, when an event is set to repeat and also promoted to the frontpage, to only the first event.

Thanks loads markfoodyburton.

Just for my intrest, I'd just like to ask you if you could explain the last line:

$query->add_where("LOCATE(CONCAT('s:3:\"nid\";i:', CAST(node.nid AS CHAR)),event_repeat.repeat_data) OR LOCATE(CONCAT('s:3:\"nid\";s:',CAST(LENGTH(CAST(node.nid AS CHAR)) AS CHAR),':\"', CAST(node.nid AS CHAR)),event_repeat.repeat_data)");

if possible, sepifically the SQL

thanks,
Asif

#2

Works for me, but showing only the first events of repeating events. And nothing more.
Is there a way to show all non-repeating events too?

#3

I guess similar functionality could be achieved with Event Repeat Views module, which is not working at all for me.

#4

Okay, after a few tries and following the hack described here and changing the view filter to "distinct" I managed to have a list of nonrepeating events with only the first of the repeating items.

#5

Need to look at this and see if it can be incorporated in.

Thanks
Robert

nobody click here