From 169ec93134cce5b9a71a438478ed7953a2d8dbcc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Jun 2010 07:27:04 -0600 Subject: [PATCH] Fix multiple ratings displayed in Tag Browser for some legacy databases --- src/calibre/library/database2.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 7e4a879654..2983ac5e58 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -782,6 +782,15 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): icon=icon, tooltip=tooltip) for r in data if item_not_zero_func(r)] + # Needed for legacy databases that have multiple ratings that + # map to n stars + for r in categories['rating']: + for x in categories['rating']: + if r.name == x.name and r.id != x.id: + r.count = r.count + x.count + categories['rating'].remove(x) + break + # We delayed computing the standard formats category because it does not # use a view, but is computed dynamically categories['formats'] = []