Ivan-Johnson / LifeLogServer

A DIY life tracking app
0 stars 0 forks source link

`batch_get`'s `limit` parameter should be optional #38

Open Ivan-Johnson opened 11 months ago

Ivan-Johnson commented 11 months ago

Instead of returning an error if the limit parameter is missing, we should just default to using a very large limit (or not having one at all?)

https://github.com/Ivan-Johnson/LifeLogServer/blob/d18ca0ab3a8dfb2743d1078a1131cc1c1bc7056d/LifeLogServer/weight.py#L227-L228

Ivan-Johnson commented 11 months ago

I assume that the original intention was we wanted the limit to be required so that the user can check if the returned results were truncated by the limit; i.e. the expectation was that if the number of results matched the limit, then the user knows that they need to make a follow-up request. In practice this doesn't actually work well; as the documentation on the function says, the behavior is undefined if the limit is more than 100. As such, we might as well have a default value of 100 for the limit (also, that limit seems rather low).

As part of this ticket, we would need some other mechanism for determining whether or not the output is truncated. Maybe a HTTP header on the response? Or could we embed multiple files in the response body (the response csv/image, plus a json/something with meta data such as this information about truncation).