UMB-CS-682-Team-03 / tracker

0 stars 0 forks source link

When on last page of results, the last range number is incorrect when fewer than pagesize elements returned. #34

Closed rouilj closed 6 months ago

rouilj commented 6 months ago

The range element of the pagination fragment 10..20 can have an incorrect end point (20 in this example) if the number of elements returned from the rest interface was not the page size (in this case pagesize = 10). See the screenshot in this comment that shows 1..50 for 5 items.

It looks like modifying getPaginationFragment() to include a pagesize and a new datasize parmeter (where datasize variable is data.collection.length in the caller). Then calculating the end count using ((parseInt(index) - 1) * parseInt(pagesize)) + datasize should fix this.

I am assigning this to Nikunj and not Malav so that we have a couple of devs working on classhelper.js. Be careful you don't accidentally clobber each other's work on a merge.