indico/newdle

OX free-busy: fetch longer time frame

Closed this issue · 3 comments

There is a bit of an issue with the OX free-busy API, since when you request the "next 3 weeks" you get all busy slots from now() to now() + timedelta(days=21) with to-the-second granularity, which means there might be slots which get cut off during the day (not at 23:59 of the last day, as you would want to).
A possible solution to this might be to request instead 4 weeks (or whatever number of weeks we need + 1) and trim the results to 23:59 of (now() + timedelta(days=21)).date().

image

Do we actually need to trim the results? Since in providers/ox we're computing the overlap of the busy intervals
with the given date, it seems like it is not a problem if we include busy information from another week. I think simply
requesting number_of_weeks + 1 might be sufficient?

javfg commented

One thing to note: number_of_weeks is limited by the OX Server. If you fetch number_of_weeks + 1, be sure to detail it in https://github.com/indico/newdle/blob/master/newdle/newdle.cfg.example#L100-L101, so users configuring newdle know they should keep the + 1 in mind.

Otherwise they will just set the max and the server will never return that extra week!

I think we need to trim that extra day because it won't have complete data, so we'd rather not show anything for that date than something incorrect/incomplete..