forked from openlp/openlp
Remove second sort from author, topic, theme search, change all sorting from sorted() to sort()
This commit is contained in:
parent
5a3e5c655c
commit
abc25744a2
@ -194,13 +194,13 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
log.debug('Authors Search')
|
log.debug('Authors Search')
|
||||||
search_string = '%' + search_keywords + '%'
|
search_string = '%' + search_keywords + '%'
|
||||||
search_results = self.plugin.manager.get_all_objects(
|
search_results = self.plugin.manager.get_all_objects(
|
||||||
Author, Author.display_name.like(search_string), Author.display_name.asc())
|
Author, Author.display_name.like(search_string))
|
||||||
self.display_results_author(search_results)
|
self.display_results_author(search_results)
|
||||||
elif search_type == SongSearch.Topics:
|
elif search_type == SongSearch.Topics:
|
||||||
log.debug('Topics Search')
|
log.debug('Topics Search')
|
||||||
search_string = '%' + search_keywords + '%'
|
search_string = '%' + search_keywords + '%'
|
||||||
search_results = self.plugin.manager.get_all_objects(
|
search_results = self.plugin.manager.get_all_objects(
|
||||||
Topic, Topic.name.like(search_string), Topic.name.asc())
|
Topic, Topic.name.like(search_string))
|
||||||
self.display_results_topic(search_results)
|
self.display_results_topic(search_results)
|
||||||
elif search_type == SongSearch.Books:
|
elif search_type == SongSearch.Books:
|
||||||
log.debug('Songbook Search')
|
log.debug('Songbook Search')
|
||||||
@ -215,7 +215,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
log.debug('Theme Search')
|
log.debug('Theme Search')
|
||||||
search_string = '%' + search_keywords + '%'
|
search_string = '%' + search_keywords + '%'
|
||||||
search_results = self.plugin.manager.get_all_objects(
|
search_results = self.plugin.manager.get_all_objects(
|
||||||
Song, Song.theme_name.like(search_string), Song.theme_name.asc())
|
Song, Song.theme_name.like(search_string))
|
||||||
self.display_results_themes(search_results)
|
self.display_results_themes(search_results)
|
||||||
elif search_type == SongSearch.Copyright:
|
elif search_type == SongSearch.Copyright:
|
||||||
log.debug('Copyright Search')
|
log.debug('Copyright Search')
|
||||||
@ -285,10 +285,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug('display results Author')
|
log.debug('display results Author')
|
||||||
self.list_view.clear()
|
self.list_view.clear()
|
||||||
search_results = sorted(search_results, key=lambda author: get_natural_key(author.display_name))
|
search_results.sort(key=lambda author: get_natural_key(author.display_name))
|
||||||
for author in search_results:
|
for author in search_results:
|
||||||
songs = sorted(author.songs, key=lambda song: song.sort_key)
|
author.songs.sort(key=lambda song: song.sort_key)
|
||||||
for song in songs:
|
for song in author.songs:
|
||||||
# Do not display temporary songs
|
# Do not display temporary songs
|
||||||
if song.temporary:
|
if song.temporary:
|
||||||
continue
|
continue
|
||||||
@ -306,7 +306,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug('display results Book')
|
log.debug('display results Book')
|
||||||
self.list_view.clear()
|
self.list_view.clear()
|
||||||
search_results = sorted(search_results, key=lambda songbook_entry:
|
search_results.sort(key=lambda songbook_entry:
|
||||||
(get_natural_key(songbook_entry.songbook.name), get_natural_key(songbook_entry.entry)))
|
(get_natural_key(songbook_entry.songbook.name), get_natural_key(songbook_entry.entry)))
|
||||||
for songbook_entry in search_results:
|
for songbook_entry in search_results:
|
||||||
if songbook_entry.song.temporary:
|
if songbook_entry.song.temporary:
|
||||||
@ -325,10 +325,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug('display results Topic')
|
log.debug('display results Topic')
|
||||||
self.list_view.clear()
|
self.list_view.clear()
|
||||||
search_results = sorted(search_results, key=lambda topic: get_natural_key(topic.name))
|
search_results.sort(key=lambda topic: get_natural_key(topic.name))
|
||||||
for topic in search_results:
|
for topic in search_results:
|
||||||
songs = sorted(topic.songs, key=lambda song: song.sort_key)
|
topic.songs.sort(key=lambda song: song.sort_key)
|
||||||
for song in songs:
|
for song in topic.songs:
|
||||||
# Do not display temporary songs
|
# Do not display temporary songs
|
||||||
if song.temporary:
|
if song.temporary:
|
||||||
continue
|
continue
|
||||||
@ -346,7 +346,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug('display results Themes')
|
log.debug('display results Themes')
|
||||||
self.list_view.clear()
|
self.list_view.clear()
|
||||||
search_results = sorted(search_results, key=lambda song: (get_natural_key(song.theme_name),
|
search_results.sort(key=lambda song: (get_natural_key(song.theme_name),
|
||||||
song.sort_key))
|
song.sort_key))
|
||||||
for song in search_results:
|
for song in search_results:
|
||||||
# Do not display temporary songs
|
# Do not display temporary songs
|
||||||
@ -366,9 +366,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug('display results CCLI number')
|
log.debug('display results CCLI number')
|
||||||
self.list_view.clear()
|
self.list_view.clear()
|
||||||
songs = sorted(search_results, key=lambda song: (get_natural_key(song.ccli_number),
|
search_results.sort(key=lambda song: (get_natural_key(song.ccli_number),
|
||||||
song.sort_key))
|
song.sort_key))
|
||||||
for song in songs:
|
for song in search_results:
|
||||||
# Do not display temporary songs
|
# Do not display temporary songs
|
||||||
if song.temporary:
|
if song.temporary:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user