Skip to content

Commit

Permalink
fix: filter_tracks access track_type bug (#8)
Browse files Browse the repository at this point in the history
* fix: filter_tracks access track_type bug

* update test for filter_tracks method

---------

Co-authored-by: faradox <[email protected]>
  • Loading branch information
faradox and faradox committed Nov 27, 2023
1 parent 0eb85ad commit 748a352
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nendo/library/sqlalchemy_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def filter_tracks(
# apply track type filter if applicable
if track_type is not None:
if isinstance(track_type, list):
query = query.filter(model.NendoTrackDB.value.in_(track_type))
query = query.filter(model.NendoTrackDB.track_type.in_(track_type))
else:
query = query.filter(model.NendoTrackDB.track_type == track_type)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def test_filter_by_track_type(self):
result = nd.library.filter_tracks(track_type="stem")
self.assertEqual(len(result), 1)
self.assertEqual(result[0].id, test_track_1.id)
result = nd.library.filter_tracks(track_type=["stem", "track"])
self.assertEqual(len(result), 2)

def test_get_tracks_filtered_by_collection(self):
"""Test filtering of tracks by collection."""
Expand Down

0 comments on commit 748a352

Please sign in to comment.