Closed OpenCoderX closed 10 years ago
Check out paginate.rb in the Neo4j gem, looks like the problem is there. It's skipping page num - 1 for some reason. Only had a second to look at it, I'm leaving to catch a plane and probably won't have access again until really late tonight or tomorrow. Should be easy to fix, though.
On Friday, November 14, 2014, tester123 notifications@github.com wrote:
It appears that even though I'm requesting page 2 and have set per_page to 10, SKIP of 1 is being used in the cypher query. I'm thinking skip should be 10 when requesting page 2 with a per_page of 10.
I've got this in my controller: @items = Item.all.paginate({page: params[:page], per_page: 10, order: :identifier})
These are the dev web server logs when requesting page 2: Processing by ItemsController#index as HTML Parameters: {"page"=>"2"} CYPHER 8ms MATCH (result:User) WHERE result.uuid = {result_uuid} RETURN result ORDER BY ID(result) LIMIT 1 | {:result_uuid=>"1e42488b-1a02-4306-a9f2-dd59e248d420"} CYPHER 5ms MATCH (n:Item) WITH n as n RETURN COUNT(n) CYPHER 7ms MATCH (n:Item) RETURN n ORDER BY n.identifier SKIP 1 LIMIT 10
— Reply to this email directly or view it on GitHub https://github.com/neo4jrb/neo4j-will_paginate_redux/issues/2.
I'll check it out. Have a nice flight.
Thanks for fixing that. Found a few minutes in the airport to merge for you.
Awesome! thanks. I'm feeling good about my first PR. I hope to contribute more, thanks for the pointer.
I'm feeling good about it, too! We'd love to have you contributing more. Get in touch if there's ever something you want to add but aren't sure where in the existing code to start. My email's in my profile.
It appears that even though I'm requesting page 2 and have set per_page to 10, SKIP of 1 is being used in the cypher query. I'm thinking skip should be 10 when requesting page 2 with a per_page of 10.
I've got this in my controller:
@items = Item.all.paginate({page: params[:page], per_page: 10, order: :identifier})
These are the dev web server logs when requesting page 2:
Processing by ItemsController#index as HTML Parameters: {"page"=>"2"} CYPHER 8ms MATCH (result:
User) WHERE result.uuid = {result_uuid} RETURN result ORDER BY ID(result) LIMIT 1 | {:result_uuid=>"1e42488b-1a02-4306-a9f2-dd59e248d420"} CYPHER 5ms MATCH (n:
Item) WITH n as n RETURN COUNT(n) CYPHER 7ms MATCH (n:
Item) RETURN n ORDER BY n.identifier SKIP 1 LIMIT 10