LCOGT / ztf-alert-server

Alert repository for ZTF alerts
GNU General Public License v3.0
6 stars 2 forks source link

Only 100 Alerts returned when `?format=json` specified #17

Open phycodurus opened 3 years ago

phycodurus commented 3 years ago

Describe the bug Only 100 Alerts returned from query when ?format=json specified

To Reproduce Steps to reproduce the behavior:

  1. Make a MARS cone search query: like this
  2. Note that there are 143 results paginated on two pages
  3. Add ?format=json to the query URL to retrieve all results as JSON: like this
  4. Note that the value of the results key of the returned JSON is a list with only 100 items, not 143 as expected.

Expected behavior For the example query given above, the returned JSON should have 143 items in the results list, not only 100.

Additional context Thank you @AlexGKim for reporting this bug.

Pommers commented 3 years ago

Additional information to above.

The has_next parameter expected in the JSON format response is always set to FALSE, but as stated by @phycodurus above, the pagination on the website / html output is correct. The has_prev parameter seems to be set appropriately.

However, on the website, the final page of a paginated list does NOT have the NEXT button greyed out - on the assumption this uses the has_next parameter, this is indicative that this is not being set appropriately. The query shown here is final page - i.e. page17 does not exist, and the NEXT button should be greyed out, but it is not.

https://mars.lco.global/?sort_value=jd&sort_order=desc&rb__gte=0.5&cone=210.80237%2C+54.34902%2C+0.399805&page=16

Note that on the first page, e.g. where ?page=1 parameter is included in query or page is not specified, the PREV button IS greyed out, which is appropriate behaviour.

https://mars.lco.global/?sort_value=jd&sort_order=desc&rb__gte=0.5&cone=210.80237%2C+54.34902%2C+0.399805&page=1

The pages and total parameters, as noted in the website help page, are not returned in the response.