← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~samothjtm/openlp/bug-1695587 into lp:openlp

 

Johannes Thomas Meyer has proposed merging lp:~samothjtm/openlp/bug-1695587 into lp:openlp.

Commit message:
added SongBook name, Song Number and Alternative Title to Entire Search

Requested reviews:
  Samuel Mehrbrodt (sam92)
Related bugs:
  Bug #1695587 in OpenLP: "Entire Song doesn't search Song Number"
  https://bugs.launchpad.net/openlp/+bug/1695587

For more details, see:
https://code.launchpad.net/~samothjtm/openlp/bug-1695587/+merge/325035

added SongBook name, Song Number and Alternative Title to Entire Search

Unfortunately the tests are failing atm but that has been before my commit as well...

lp:~samothjtm/openlp/bug-1695587 (revision 2746)
[←[1;32mSUCCESS←[1;m] https://ci.openlp.io/job/Branch-01-Pull/2049/
[←[1;31mFAILURE←[1;m] https://ci.openlp.io/job/Branch-02-Functional-Tests/1959/
Stopping after failure

-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2017-01-25 21:17:27 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2017-06-03 10:58:25 +0000
@@ -231,9 +231,13 @@
 
     def search_entire(self, search_keywords):
         search_string = '%{text}%'.format(text=clean_string(search_keywords))
-        return self.plugin.manager.get_all_objects(
-            Song, or_(Song.search_title.like(search_string), Song.search_lyrics.like(search_string),
-                      Song.comments.like(search_string)))
+        return (self.plugin.manager.session.query(Song)
+                .join(SongBookEntry, isouter=True)
+                .join(Book, isouter=True)
+                .filter(or_(Book.name.like(search_string), SongBookEntry.entry.like(search_string),
+                            Song.search_title.like(search_string), Song.search_lyrics.like(search_string),
+                            Song.comments.like(search_string), Song.alternate_title.like(search_string)))
+                .all())
 
     def on_song_list_load(self):
         """


Follow ups