First:1 and Last:1 returning same record

Hello!

I’m using the following query:

query {
    picks_per_day (date_from:"2020-12-01", date_to:"2020-12-02") {
        request_id
        complexity
        data (first:1) {
            pageInfo {
                hasPreviousPage
                hasNextPage
                endCursor
            }
            edges {
                cursor
                node {
                    id
                    user_first_name
                    user_last_name
                    order_number
                    sku
                    picked_quantity
                    inventory_bin
                    barcode_scanned
                    created_at
                }
            }
        }
    }
}

We have hundreds of picks between the two days, yet if I change the query to “last: 1” instead of “first: 1”, it returns the exact same record. Why wouldn’t this change the query to return the most recent pick instead of the oldest pick in that range? Is there something else I need in the query to make that happen?

Request ID when using “first:1”: 5fc7ff74e60095f8f64bc892
Request ID when using “last:1”: 5fc80146f0a5b6b73e425f61

Thanks,
Jeremy

Hi @jeremyw!
Thanks for reporting this and for including that level of detail :+1:
It seems like the last filter is not working as it should (not specific to this only query actually)
This has already been escalated to our engineers.
I will let you know as soon as we are able to fix this.
Thanks again!
Tom

1 Like

Hi @jeremyw!
An update about this: We will be making the fix for it with some other improvements on the backend of the Public API, but we are aiming to land those changes in January.

In the meantime a workaround for this would be to sort descending and ask for the N first results, changing the sorting only.

I apologize for the inconvenience and please let me know if there is anything else I could help with.
Thanks again!
Tom

1 Like