fixed bug #1000729 'Support more song fields in the search' - corrected CCLI number sorting'

Fixes: https://launchpad.net/bugs/1000729
This commit is contained in:
Chris Hill 2015-02-13 18:49:31 +00:00
parent a95894fba4
commit 17d756514c

View File

@ -225,7 +225,7 @@ class SongMediaItem(MediaManagerItem):
log.debug('CCLI number Search') log.debug('CCLI number 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, and_(Song.ccli_number.like(search_string), Song.ccli_number != ''), Song.ccli_number.asc()) Song, and_(Song.ccli_number.like(search_string), Song.ccli_number != ''))
self.display_results_cclinumber(search_results) self.display_results_cclinumber(search_results)
self.check_search_result() self.check_search_result()
@ -326,6 +326,7 @@ class SongMediaItem(MediaManagerItem):
def display_results_cclinumber(self, search_results): def display_results_cclinumber(self, search_results):
log.debug('display results CCLI number') log.debug('display results CCLI number')
self.list_view.clear() self.list_view.clear()
search_results.sort(key=lambda song: int(song.ccli_number))
for song in search_results: for song in search_results:
# Do not display temporary songs # Do not display temporary songs
if song.temporary: if song.temporary: