CGCalendar upcominglist skipping events Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
mecca
New Member
New Member
Posts: 3
Joined: Tue Apr 05, 2022 3:51 pm

CGCalendar upcominglist skipping events

Post by mecca »

Hi guys,

out of the blue we have the problem that some events in the upcoming list are being skipped. This is our content:

{cms_module module='CGCalendar' display='upcominglist' limit='5'}

We have some events in April, May and June that are skipped.

Weirdly, when I set the limit to 20 for instance, the actual upcoming events are not skipped. I guess it has something to do with how the system sorts or queries the events but I dont even know how to debug that or where to look. Any ideas?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGCalendar upcominglist skipping events

Post by DIGI3 »

Do 5 events show, or does it show less than 5 when it skips some? If the latter, then there's probably some template logic preventing them from showing.

If it's showing 5 other events then my guess would be a date formatting issue - but that would depend where they show up when you display 20 events. I don't think there's a known bug that would cause this behaviour so it's likely something unique to those events, your setup, or your templates.
Not getting the answer you need? CMSMS support options
mecca
New Member
New Member
Posts: 3
Joined: Tue Apr 05, 2022 3:51 pm

Re: CGCalendar upcominglist skipping events

Post by mecca »

Hey DIGI3,

thanks for your feedback so far. It is showing 5 events but skipping the closest ones. Events for April, May and June are completely skipped and starting with the July 1st the output starts.

As far as I've seen there is no date skipping or comparison logic in my template. In my understanding, that must be a db query and the n results are being rendered with a template. Any idea where the actual logic happens? I also guess it has to do with date formatting but I believe thats all untouched by me.

I also have a "normal" list with all events ordered in ASC date and that works fine, dates for April, May, June, July, etc are shown in the correct order. The content is:

{cms_module module='CGCalendar' display='upcominglist'}

Could it be that the limit is called before the ordering under the hood? Something like get the last created events and sort by upcoming or something?
Last edited by mecca on Thu Apr 07, 2022 1:32 pm, edited 1 time in total.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGCalendar upcominglist skipping events

Post by DIGI3 »

It's entirely possible there's a bug but it would be strange to only be hearing about it now. I don't know the underlying logic, and the author has abandoned the module so it's going to be a tough one. Perhaps one of the module devs who use this will consider forking it and can look deeper into your issue.

If you can recreate it on another installation that would be helpful, I still do think it's specific to yours but it's hard to tell without doing my own tests and troubleshooting on it.
Not getting the answer you need? CMSMS support options
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CGCalendar upcominglist skipping events

Post by velden »

What version of CGCalendar are you using?

You could also try to enable debug mode and see if the relevant queries are displayed on your page.
You can then first inspect the queries and secondly run them on your database to see what the results are.

The most relevant query has this string in it so you could search that on your page: 'module_cgcalendar_events WHERE event_id IN'
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: CGCalendar upcominglist skipping events

Post by paulbaker »

Just to add I use CGCalendar in the same way as you and I have never seen the behaviour you describe. So I don't think it's a module bug. Not sure what it is though...

Here are 2 module calls.

Code: Select all

{cms_module module="CGCalendar" display="upcominglist" limit="3" listtemplate="UpcomingHome2" displayforday="true"}

Code: Select all

{cms_module module="CGCalendar" display="upcominglist" displayforday="1" limit="4" listtemplate="CGCalendar-List-View-UpComingSide"}
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
mecca
New Member
New Member
Posts: 3
Joined: Tue Apr 05, 2022 3:51 pm

Re: CGCalendar upcominglist skipping events

Post by mecca »

Hey everyone,

thank you so much for taking your time and helping me. Debugging the query was very helpful. The following query was built:

Code: Select all

SELECT DISTINCT E.event_id FROM cms_module_cgcalendar_events E
 WHERE ((E.event_date_start >= '2022-04-11 00:00:01') OR (E.event_date_end > '2022-04-11 00:00:01')) AND E.event_status = 'P' LIMIT 5
Which, to me, seems like a big bug in CGCalendar since events that have been created first but actually take place later in the year are being shown first (I get asc event ids). I think it should be something like this:

Code: Select all

SELECT DISTINCT E.event_id FROM cms_module_cgcalendar_events E WHERE ((E.event_date_start >= '2022-04-11 00:00:01') OR (E.event_date_end > '2022-04-11 00:00:01')) AND E.event_status = 'P' ORDER BY E.event_date_start ASC;
I am using version 2.6.2 and CMS does not find any update. How do I proceed from here? Do I have a faulty version or any idea where I can alter the query in the code?

Thanks again.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CGCalendar upcominglist skipping events

Post by velden »

I think that code comes from
lib\class.cgcalendar_utils.php starting at line 307

However, line 352 holds the ORDER BY statement, so I'm surprised it doesn't show up in your logging.

The module is abandoned by its developer. So for now you can either fork the module and become the dev yourself :-) or alter the code in your install.
But first I'd try to find out why your query doesn't hold the order by statement.
mecca
New Member
New Member
Posts: 3
Joined: Tue Apr 05, 2022 3:51 pm

Re: CGCalendar upcominglist skipping events

Post by mecca »

@velden Can you imagine - line 352 was commented out in the code! Thank you so much for your support everyone, it works now.
Last edited by mecca on Tue Apr 12, 2022 9:06 am, edited 1 time in total.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: CGCalendar upcominglist skipping events

Post by paulbaker »

paulbaker wrote: Fri Apr 08, 2022 12:46 am Just to add I use CGCalendar in the same way as you
Confession time....the sites I quoted do not use the latest version of CGCalendar, which is why I was getting different behaviour. Glad you sorted it.

Sounds like this should be added as a bug?:
http://dev.cmsmadesimple.org/bug/list/623
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
mecca
New Member
New Member
Posts: 3
Joined: Tue Apr 05, 2022 3:51 pm

[SOLVED] Re: CGCalendar upcominglist skipping events

Post by mecca »

Well when I download the module line 352 is not commented out, so it mustve been someone in the past that fiddled with the modules code on our site. Doesnt seem like a bug but an individual problem.
Locked

Return to “Modules/Add-Ons”