From 9e57a47bb57ad2e3170972db4040d336afd0c6ee Mon Sep 17 00:00:00 2001 From: socks Date: Thu, 20 Apr 2017 18:34:41 +0100 Subject: [PATCH] Fixed bug where an extra blank page would show on "latest" if number of quotes was divisible by 10 --- smash/views.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/smash/views.py b/smash/views.py index 39f35f6..84a1d77 100644 --- a/smash/views.py +++ b/smash/views.py @@ -79,7 +79,7 @@ def latest(): "latest.html", title="Latest", quotes=quotes, - numpages=1 + allquotes//10, + numpages=1 + allquotes//10 if allquotes%10 != 0 else allquotes//10, curpage=0, page_type="latest" ) @@ -95,15 +95,15 @@ def latest_page(page): for quote in quotes: quote.content = str(Markup.escape(quote.content)).replace('\n', '
') - return render_template( - "latest.html", - title="Latest - page {}".format(page), - quotes=quotes, - numpages=1 + allquotes//10, - curpage=page-1, - page_type="latest" - ) - + return render_template( + "latest.html", + title="Latest - page {}".format(page), + quotes=quotes, + numpages=1 + allquotes//10 if allquotes%10 != 0 else allquotes//10, + curpage=page-1, + page_type="latest" + ) + @app.route('/queue') def queue(): if not session.get('authorized'):