saintpete / logrole

Logrole for Twilio - Create User Roles for Limited Access to Twilio Logs
Other
27 stars 10 forks source link

Search using non-UTC days #6

Closed kevinburke closed 7 years ago

kevinburke commented 7 years ago

Currently all DateCreated><= searches are implemented with the date field in UTC. This can be confusing for a user that has a different timezone set - if they are UTC-8, they might not see the 8 hours of results that are from the previous day.

To fix this Twilio would either need to offer a TZ-aware search option, allow hours-based searching, or we'd need to search multiple days and filter the result sets in memory.

kevinburke commented 7 years ago

If I'm reading correctly that's basically this: "we'd need to search multiple days and filter the result sets in memory." For your example, we would need to send StartDate<=2016-11-05&StartDate>=2016-11-04 and then filter out the results that aren't in the available time range. Twilio doesn't offer more granular date filters.

The other problem is since we're filtering on the server a "page" of results may have less than 50 results. For example, Twilio returns results in date order and lets you page backwards, so you'd start getting results for 23:59:59 on 11/05/16 and going backwards from there. We'd filter out those results since they don't match the time range, so you'd either get a completely empty page of results or we'd need to do another API query, and continually querying until we finally got records in the right time range.

kevinburke commented 7 years ago

We'd need to convert the date range to UTC, search that range of days, then filter the results.

The "max resource age" filters work at a lower level - there's no limitation against searching Twilio for older results, they just won't be viewable in the final display.

kevinburke commented 7 years ago

So the part I was missing is that the Dashboard supports much finer-grained search. I'm implementing this in twilio-go now. I think we can get to a really good place.

kevinburke commented 7 years ago

I've just merged the fix for this. Upgrade to 0.71 or higher to get a version that has timezone-aware, to-the-hour search.