From 280efad939d07a305d524fa0ab0db7681ad3ee16 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 12 Jul 2021 14:04:23 +0200 Subject: [PATCH] #2052 (wrong series index shown for series_index >=100) --- cps/jinjia.py | 2 +- cps/web.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cps/jinjia.py b/cps/jinjia.py index 00778335..70a6090e 100644 --- a/cps/jinjia.py +++ b/cps/jinjia.py @@ -114,7 +114,7 @@ def yesno(value, yes, no): @jinjia.app_template_filter('formatfloat') def formatfloat(value, decimals=1): value = 0 if not value else value - return ('{0:.' + str(decimals) + 'g}').format(value) + return ('{0:.' + str(decimals) + 'f}').format(value).rstrip('0').rstrip('.') @jinjia.app_template_filter('formatseriesindex') diff --git a/cps/web.py b/cps/web.py index a14afb68..9dab285a 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1704,7 +1704,7 @@ def read_book(book_id, book_format): if len(book.series): title = title + " - " + book.series[0].name if book.series_index: - title = title + " #" + '{0:.2g}'.format(book.series_index) + title = title + " #" + '{0:.2f}'.format(book.series_index).rstrip('0').rstrip('.') log.debug(u"Start comic reader for %d", book_id) return render_title_template('readcbr.html', comicfile=all_name, title=title, extension=fileExt)