-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paginate the list of bills #480
Conversation
Thanks for starting working on this :-) On the things to improve :
I would go for 100 bills displayed by default.
404 seems to be the sane thing to do.
I wonder if we should try to use autoscroll here, in order to load the bills as they're needed?
Yes! (But I'm bad at this :()
I wonder if paginating would make it faster? I believe it would just add some overhead here, don't you think? But, how to enhance the API is probably an issue by itself. We could probably enhance how we synchronize, but that's a bunch of changes. I've been working (with @Natim, who's a contributor here) on the Kinto project, which is basically an JSON HTTP API, made to be efficient. We might want to borrow some principles we've implemented there :
|
Hey @zorun, hope everything's going well. Are you okay with this, or do you need any help? |
Hey. This seems stalled. I believe that until we have some news from @zorun we should close the pull request (it's been more than 3 months) |
4ba099f
to
248a54c
Compare
@almet yeah sorry, didn't have time to work on this. I just rebased and pushed, with a few changes:
This should be ready for merging, unless we want to have a configuration option to choose the number of bills per page. |
Neat! You can run black on web.py to fix the travisCI error. I believe that if there is no pagination, the section is still shown, can we change this? |
We display 100 bills on each page. We only show previous/next buttons (at the top of the view) and the list of pages (at the bottom) if there are more than one pages. This uses built-in pagination support from Flask-SQLAlchemy: https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.BaseQuery.paginate https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.Pagination
248a54c
to
8ac1bdf
Compare
Right, it should be better now. I have also improved the rendering using Bootstrap classes: For the screenshot I displayed just 1 item per page, this is of course not the case for the final commit (100 items per page). @almet does it sound good? I am not a designer but bootstrap makes a lot of things easier :) |
yeah, it's great, thanks! |
We display 100 bills on each page. We only show previous/next buttons (at the top of the view) and the list of pages (at the bottom) if there are more than one pages. This uses built-in pagination support from Flask-SQLAlchemy: https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.BaseQuery.paginate https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.Pagination
We display 100 bills on each page. We only show previous/next buttons (at the top of the view) and the list of pages (at the bottom) if there are more than one pages. This uses built-in pagination support from Flask-SQLAlchemy: https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.BaseQuery.paginate https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.Pagination
This is a work-in-progress proposal to paginate the list of bills. The main motivation is that I have 1095 bills, and the list of bills is starting to be slow to display!
Before investing time in design etc, I would like to first gather some feedback on the idea itself.
By default, the first page is displayed (most recent bills). Older bills can be displayed with the
page
URL parameter:Documentation for this feature in flask-sqlalchemy is here:
https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.BaseQuery.paginate
https://flask-sqlalchemy.palletsprojects.com/en/2.x/api/#flask_sqlalchemy.Pagination
Some things to improve:
Here is a screenshot, with only 2 items per page for testing: