-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No API to retrieve "next" event #103
Comments
Hi,
this sounds interesting. I was wondering:
Do you have an example with so many events? How do you use it so we can benchmark it. There is already one benchmark script that led to refactoring.
You say the data changes. The library or I assume a static calendar. What does change? Caching for speed is important but there is no cache invalidation nor updating.
How would you use it?
```
it = recurring_ical_events.of(...).after(..., ascending=True)
it = recurring_ical_events.of(...).before(..., ascending=False)
```
Both return an iterator. Iterators are used internally already.
That would be my impression.
My guess is that you witness O(x*x). The best we can do is from my view is O(x*log(x)) where x is somehow related to the number of event entries because this should be equivalent to a sorting problem. Modifications cost at best O(log(x)).
Did you see the section about re-using the object from `of()`?
I am happy to assist in any case. Additionally: If you like me to implement this, I am happy to get paid as at the moment, we live below the local poverty line and that means I prioritize survival over contributing to the digital commons which I rather would.
What are your thoughts on my ideas?
|
I added the |
I think that the after() method would do this. However, we could also add a @basak if you would like to link your project in the related project's section, this is very welcome! |
Hi,
First, thank you for this package! I'm writing some code to handle calendar events as they occur in real time. With python-recurring-ical-events it's really easy for a user to create a recurring calendar event and have an app interacting with their calendar respond to it.
But since I'm working in real time, the "expand everything within a time span" doesn't really work for me, because the time span is constantly moving. My calendar has about 3000 objects, and constantly trying to do this even for just the next day takes on the order of minutes. Of course most of those events are in the past and don't need looking at again, but it isn't very easy to arrange that.
What would be really useful is a "get next event" method, just like what
datetime.rrule.rrule.after
provides. It looks like I can hack that by instantiating aRecurringEvent
directly myself, and then accessing therule
attribute, which would be adateutil.rrule.rruleset
object. But, I don't think is is a formal part of the python-recurring-ical-events API, and also it would miss any changes in specific instances of the recurring set, such as in #62.Ideally,
UnfoldableCalendar
would haveafter
andbefore
methods, just likedateutil.rrule.rrule
, and would return the next or previous event relative to a given time. This would allow an app to follow events in real time. These would probably need to be implemented by considering therule.after()
(orrule.before()
) against every containedRecurringEvent
, considering any specific instances that override the rule, and doing some sorting. Forbefore
, one would also ideally find the event that ends most recently before the given time.I thought I'd register this wishlist item and see if you have an opinion. I'm not sure whether to tackle this myself or not, but I wonder if this would be something you'd be willing to accept? It might require some refactoring!
We're using [Polar.sh](https://polar.sh/niccokunzmann) so you can upvote and help fund this issue. We receive the funding once the issue is completed & confirmed by you. Thank you in advance for helping prioritize & fund our work.
The text was updated successfully, but these errors were encountered: