From a8317d900b16eb912b1a7ea24d534376f5ae3439 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 30 Oct 2021 15:50:17 +0200 Subject: [PATCH] Bugfix for edit custom ratings in list edit mode Bugfix for deleting custom enum in list edit mode --- cps/editbooks.py | 1 + cps/static/js/table.js | 3 +++ cps/templates/book_table.html | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/editbooks.py b/cps/editbooks.py index 99d4f69a..263a69fb 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -1096,6 +1096,7 @@ def table_get_custom_enum(c_id): cc = (calibre_db.session.query(db.Custom_Columns) .filter(db.Custom_Columns.id == c_id) .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).one_or_none()) + ret.append({'value': "", 'text': ""}) for idx, en in enumerate(cc.get_display_dict()['enum_values']): ret.append({'value': en, 'text': en}) return json.dumps(ret) diff --git a/cps/static/js/table.js b/cps/static/js/table.js index d1a32862..0600f0b3 100644 --- a/cps/static/js/table.js +++ b/cps/static/js/table.js @@ -645,6 +645,9 @@ function singlecheckboxFormatter(value, row){ } function ratingFormatter(value, row) { + if (value == 0) { + return ""; + } return (value/2); } diff --git a/cps/templates/book_table.html b/cps/templates/book_table.html index 6f8e8747..fb0cfed8 100644 --- a/cps/templates/book_table.html +++ b/cps/templates/book_table.html @@ -76,7 +76,7 @@ {% if c.datatype == "int" %} {{c.name}} {% elif c.datatype == "rating" %} - {{c.name}} + {{c.name}} {% elif c.datatype == "float" %} {{c.name}} {% elif c.datatype == "enumeration" %}