From c6509de909d15a0535d395bacef5bc5a50505ddb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Jan 2013 19:34:47 +0530 Subject: [PATCH] ... --- src/calibre/db/categories.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index 092b6da877..ec4725ff9f 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -113,6 +113,16 @@ def get_categories(dbcache, sort='name', book_ids=None, icon_map=None): cats.sort(key=key) categories[category] = cats + # Needed for legacy databases that have multiple ratings that + # map to n stars + for r in categories['rating']: + for x in tuple(categories['rating']): + if r.name == x.name and r.id != x.id: + r.id_set |= x.id_set + r.count = r.count + x.count + categories['rating'].remove(x) + break + return categories