Closed ancker010 closed 3 years ago
I added the 'from' and 'to' filters back in, since I didn't want to break existing uses of pyzm. To go with that, I added a "DEPRECATED" warning to the docs for those filters.
I wonder if instead of adding two new parameters and deprecating one, we add to
to from and to.
So:
from: 9am to 9:05am
to 7pm to 9 pm
. We split on to
if it exists. If not, it continues the old way. It is an easy parse. Then we don't have make API changes plus not worry about a user mistakenly add a from and start-from and handle those situations (I am not in favor of deprecating from/to ). The reason I bring this up is this PR really seems to be a special case and not a very common situation.
I'll try to figure out the to
separator. But I prefer your use of relative time in the filters.
So: 10 minutes ago to 5 minutes ago
I don't think it's that special of a case, though. The current implementation only lets you select ALL events that start after the from
time. That's useful if you only care about recent events. But if you are writing a script that is trying to correlate events with an external system, being able to say "return all results that started in a 10 minute window around "time" would be needed.
Yup, I do think "started in a 10 min window around time" is a less probable case for most users compared to "events between time A to time B" or "events X hours ago". I understand your usecase - I feel your use-case isn't something that a lot of people would need.
That being said, it doesn't matter. All we really need to do is add "to" in the existing to and from and your use-case is served and we don't add new attributes.
Ignore that last commit, I need to fix something.
Okay. That latest commit should implement things they way you're expecting.
from: 10 minutes ago
-> return ALL events with StartDate after 10 minutes ago.
from: 10 minutes ago to 5 minutes ago
-> return events with StartDate after 10 minutes ago, but not after 5 minute ago
Similar logic in place for to
, but I had to do it slightly differently since the order of the window is swapped from the default case.
This PR includes adjustments to Events.py and corresponding code to change the following: 1) Rename 'from' and 'to' filters to better reflect filter action. 2) Add 'starts-before', 'starts-after', 'ends-before', and 'ends-after' parameters.
Thanks