Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Eventlist: Option "shortened view" not activated – multi-day events show up with dates already past #8782

Closed
arno1979 opened this issue Sep 11, 2017 · 9 comments
Assignees
Labels
Milestone

Comments

@arno1979
Copy link

Steps to reproduce:

  • An eventlist module configured to show only upcoming events.
  • Option "shortened view" NOT activated.
  • A multi-day event that begins in the past (e.g. 2017-09-01) and reaches into the future (e.g. 2017-09-15)

Result: Today (2017-09-11) the eventlist shows single events from 2017-09-01 to 2017-09-15. (see screenshot)

Expected result: Only events from 2017-09-11 to 2017-09-15 are shown.

This applies to both Contao 3.x.x and 4.x.x

bildschirmfoto 2017-09-11 um 15 55 04

@leofeyer
Copy link
Member

Does the "hide running events" checkbox change this?

@arno1979
Copy link
Author

arno1979 commented Sep 12, 2017

No, it doesn't make a difference. (Tested on the demo just now.)
Also noticed that it works the other way too: If I set the listview module to show only past events from the last three months, upcoming dates are also shown. Although, as it seems, only up to one day into the future: In my example the list shows up to and including the event on 2017-09-13, but not the ones on the 14th and 15th.

@leofeyer
Copy link
Member

@fritzmg Can you confirm this?

@arno1979
Copy link
Author

Working further on this and also #8786 I found out the following:
In ModuleEventlist.php: Adding a value $currTime = \Date::floorToMinute(); on line 160 (inspiration taken from calendar_extended) and adding two if statements comparing the current timestamp against the correct timestamp of each single event a little further below in the code helped to seemingly solve the problem for me.

My changes look like this:
On line 174 we find this if statement:

// Skip occurrences in the past but show running events (see #8497)
if ($event['repeatEnd'] && $event['end'] < $intStart)
{
    continue;
}

I added the two following if statements:

// Skip occurrences in the past but show running events, for long list view only
if (!$this->cal_noSpan && strpos($this->cal_format,'next') !== false && $day < $currTime-86400)
{
    continue;
}

// Skip occurrences in the future but show running events, for long list view only
if (!$this->cal_noSpan && strpos($this->cal_format,'past') !== false && $day > $currTime-86400)
{
    continue;
}

I have not tested this extensively and I admit that it does not look very elegant. But at this point it is the best I could come up with (events are one tricky subject! and are driving me little insane at this point) and maybe it could help you finding the best possible solution.

This of course does not fix the problems with the overlap from #8786! Just in case you wondered.

@leofeyer
Copy link
Member

Fixed in 03d2a8b.

@arno1979
Copy link
Author

arno1979 commented Sep 28, 2017

Hi,

I just applied your fix and noticed one little problem:
I included the condition !$this->cal_noSpan in my if statements. You chose to leave out this condition and now combined entries for multi-day events that started in the past do not show up in shortened list views with upcoming dates anymore.
Can you please reconsider changing your code to:

if (!$this->cal_noSpan && strncmp($this->cal_format, 'next_', 5) === 0 && $day < $intStart)
{
    continue;
}

if (!$this->cal_noSpan && strncmp($this->cal_format, 'past_', 5) === 0 && $day >= $intEnd)
{
    continue;
}

Thanks!

@leofeyer leofeyer reopened this Sep 28, 2017
@leofeyer leofeyer modified the milestones: 3.5.29, 3.5.30 Sep 28, 2017
@intradesign
Copy link

Hi,
is it possible that there is a similar problem with recurring events?

It seems that recurring events in the past show up in event lists when the event list settings are set to "show future events". The first occurance of the event seems to be the indicator for showing or not showing the event items.

Thanks!

@leofeyer
Copy link
Member

leofeyer commented Oct 5, 2017

combined entries for multi-day events that started in the past do not show up in shortened list views with upcoming dates anymore

@arno1979 How can I reproduce this?

@leofeyer
Copy link
Member

leofeyer commented Oct 5, 2017

Never mind, I found out myself. Fixed in 477bb59.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants