Closed nickjangveladze closed 2 months ago
@nickjangveladze I am facing the same issue. Were you able to resolve it? Can we use Recurring Events here?
@nickjangveladze @taher-k5 isnt that just a query issue?
$fetchInfo['start']
would be 2024-08-01
when you're in August, excluding the events that started in July
I hope my comment above fixed your issue, please reopen this if needed.
so whats the fix ? i dont get it
@YonkoSam You need to remove where condition from query in fetchEvents function
public function fetchEvents(array $fetchInfo): array
{
return Event::query()
->where('starts_at', '>=', $fetchInfo['start']) // remove this
->where('ends_at', '<=', $fetchInfo['end']) // remove this
->get()
->map(
fn (Event $event) => [
'title' => $event->id,
'start' => $event->starts_at,
'end' => $event->ends_at,
'url' => EventResource::getUrl(name: 'view', parameters: ['record' => $event]),
'shouldOpenUrlInNewTab' => true
]
)
->all();
}
wouldn't that make it very bad optimized to query all the task each time
@YonkoSam You could subtract one month from the 'start' during your fetch, so you'd get anything that started in the previous month. Looking at August? Find events from July 1 - Aug 31, etc.
Or... further back if you have any events that might span 2 months, etc.
I have 2 events:
For example, when I'm in July, the first event is visible from July 27th to August 9th, but when I move to August, the first event is not visible until August 9th. Only the second event is visible from August 9th to August 17th.
July
August