Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Pagination #68

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

jabbate19
Copy link
Collaborator

So you know how Quotefault takes a small fucking eternity to load? Fixed.

Copy link
Contributor

@mxmeinhold mxmeinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any way to do a search by content after pagination?

quotefault/__init__.py Outdated Show resolved Hide resolved
quotefault/templates/bootstrap/storage.html Outdated Show resolved Hide resolved
@@ -192,7 +192,7 @@ def get_quote_query(speaker: str = "", submitter: str = "", include_hidden: bool
quote_query = db.session.query(Quote,
func.sum(Vote.direction).label('votes')).outerjoin(Vote).group_by(Quote)
# Put the most recent first
quote_query = quote_query.order_by(Quote.quote_time.desc())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this?

Comment on lines +244 to +245
begin=max(1, page-6),
end=min(page+6, rows) + 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this logic not be done in jinja? seems kinda weird to pass these when you're already passing the page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Min and Max are not jinja functions

submitter = request.args.get('submitter'))

rows = query.count()
rows = int(rows//20 + bool(rows%20 > 0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really rows? Seems more like it's total number of pages

quotefault/templates/bootstrap/storage.html Outdated Show resolved Hide resolved
Comment on lines 33 to 35
<li class="page-item">
<a class="page-link" href="/storage/{{ num }}">{{ num }}</a>
</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

planning to mark the current page separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should, good point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants