diff --git a/cps/db.py b/cps/db.py index 4b0a7ac7..9c5b5657 100644 --- a/cps/db.py +++ b/cps/db.py @@ -796,23 +796,24 @@ class CalibreDB(): def speaking_language(self, languages=None, return_all_languages=False, with_count=False, reverse_order=False): from . import get_locale - if not languages: - if with_count: + if with_count: + if not languages: languages = self.session.query(Languages, func.count('books_languages_link.book'))\ .join(books_languages_link).join(Books)\ .filter(self.common_filters(return_all_languages=return_all_languages)) \ .group_by(text('books_languages_link.lang_code')).all() - for lang in languages: - lang[0].name = isoLanguages.get_language_name(get_locale(), lang[0].lang_code) - return sorted(languages, key=lambda x: x[0].name, reverse=reverse_order) - else: + for lang in languages: + lang[0].name = isoLanguages.get_language_name(get_locale(), lang[0].lang_code) + return sorted(languages, key=lambda x: x[0].name, reverse=reverse_order) + else: + if not languages: languages = self.session.query(Languages) \ .join(books_languages_link) \ .join(Books) \ .filter(self.common_filters(return_all_languages=return_all_languages)) \ .group_by(text('books_languages_link.lang_code')).all() - for lang in languages: - lang.name = isoLanguages.get_language_name(get_locale(), lang.lang_code) + for lang in languages: + lang.name = isoLanguages.get_language_name(get_locale(), lang.lang_code) return sorted(languages, key=lambda x: x.name, reverse=reverse_order) diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 3c54e88b..d291d368 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
Start Time: 2021-12-05 19:18:28
+Start Time: 2021-12-22 20:24:40
Stop Time: 2021-12-05 22:58:48
+Stop Time: 2021-12-23 00:00:41
Duration: 3h 0 min
+Duration: 2h 57 min
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_additional_books.py", line 300, in test_writeonly_path + self.assertTrue(os.path.isdir(book_path)) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books.py", line 177, in test_edit_author + self.assertTrue(os.path.isdir(os.path.join(TEST_DB, 'O0u Zhi', 'book8 (8)'))) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_books.py", line 74, in test_edit_title + self.assertTrue(os.path.isdir(os.path.join(TEST_DB, values['author'][0], 'O0u Zhi (4)'))) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 297, in test_edit_author + self.assertTrue(gdrive_path) +AssertionError: False is not true+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 143, in test_edit_title + self.assertTrue(gdrive_path) +AssertionError: False is not true+
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 583, in test_book_download - data = self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 602, in test_kobo_sync_selected_shelfs - data = self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 652, in test_kobo_upload_book - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 447, in test_shelves_add_remove_books - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 277, in test_sync_changed_book - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 514, in test_sync_reading_state - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 296, in test_sync_shelf - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 242, in test_sync_unchanged - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 256, in test_sync_upload - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync.py", line 111, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 260, in test_kobo_sync_selected_shelfs - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 103, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 164, in test_sync_changed_book - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 103, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 237, in test_sync_reading_state - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 103, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 193, in test_sync_shelf - self.inital_sync() - File "/home/ozzie/Development/calibre-web-test/test/test_kobo_sync_big.py", line 103, in inital_sync - self.assertEqual(r.json(), {}) -AssertionError: {'Benefits': {}} != {} -- {'Benefits': {}} -+ {}-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_zz_helper.py", line 44, in test_check_chinese_Characters + self.assertEqual(helper.get_valid_filename(u'执一'), u'Zhi Yi') +AssertionError: '执一' != 'Zhi Yi' +- 执一 ++ Zhi Yi+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_zz_helper.py", line 71, in test_check_deg_eur_replacement + self.assertEqual(helper.get_valid_filename(u'°€'), u'degEUR') +AssertionError: '°€' != 'degEUR' +- °€ ++ degEUR+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_zz_helper.py", line 36, in test_check_doubleS + self.assertEqual(helper.get_valid_filename(u'§ß'), u'SSss') +AssertionError: '§ß' != 'SSss' +- §ß ++ SSss+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_zz_helper.py", line 32, in test_check_high23 + self.assertEqual(helper.get_valid_filename(u'²³'), u'23') +AssertionError: '²³' != '23' +- ²³ ++ 23+
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_zz_helper.py", line 40, in test_check_umlauts + self.assertEqual(helper.get_valid_filename(u'ÄÜÖäöü'), u'AUOaou') +AssertionError: 'ÄÜÖäöü' != 'AUOaou' +- ÄÜÖäöü ++ AUOaou+