← Back to team overview

dhis2-devs-core team mailing list archive

Re: Paging total being wrong on empty result?

 

This
<http://bazaar.launchpad.net/~dhis2-devs-core/dhis2/trunk/revision/17914>
commit from a week ago seems to confirm that this is new behaviour.

2015-01-16 13:39 GMT+01:00 Mark Polak <markpo@xxxxxxxxxx>:

> Hey Morten,
>
> That kind of depends on how you look at the pages. I guess if there were 0
> results it could still mean 1 page but just with 0 results. Since “page” 0
> will never exist.
> However if you base the pages of the number of results then i guess it
> should be page 0 and pageCount 0.
>
> That sounds more like a design decision than something that is wrong
> however personally i guess i would like page 1/pageCount 1 more than page
> 0/pageCount 0.
>
> Non the less i agree the total amount should be 0. As now a total of 1
> could mean 1 item or 0 items. Which you can only know based on the data
> returned.
>
> Kind regards,
>
> Mark Polak
> mark@xxxxxxxxxxxxxxx
> markpo@xxxxxxxxxx
> +47 970 36 752
>
> On 16 Jan 2015, at 05:31, Morten Olav Hansen <mortenoh@xxxxxxxxx> wrote:
>
> Hi Mark
>
> I think it has been like this since the first time we introduced the pager
> element.. I agree its a bit weird
>
> Total should be 0 of course, do we still want to see pageCount = 1 ? even
> if there is no results? or would that be pagecount = 0 ?
>
> On Thu Jan 15 2015 at 10:44:43 PM Mark Polak <markpo@xxxxxxxxxx> wrote:
>
>> Hey Morten,
>>
>> I ran into a sort of peculiar thing and i believe it is a small bug.
>>
>> When requesting an endpoint with a filter that returns no results. The
>> pager object still marks the total items as being 1.
>> https://apps.dhis2.org/dev/api/dataElements?filter=name:like:sdfdsfsfgdfdd
>>
>> {
>> -pager: {
>> page: 1,
>> pageCount: 1,
>> total: 1
>> },
>> -dataElements: (0)[
>> ]
>> }
>>
>> Kind regards,
>>
>> Mark Polak
>> mark@xxxxxxxxxxxxxxx
>> markpo@xxxxxxxxxx
>> +47 970 36 752
>>
>>
>
> --
> Mailing list: https://launchpad.net/~dhis2-devs-core
> Post to     : dhis2-devs-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs-core
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References