From ad22a3529f23e9fa1f85d1557f6a1dc3ea3bf8a4 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 10 Jul 2017 21:26:57 -0700 Subject: [PATCH] Fixed a bug where songs weren't sorted correctly in api/flatten --- src/index.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.rs b/src/index.rs index 2c4960c..09da07d 100644 --- a/src/index.rs +++ b/src/index.rs @@ -524,6 +524,7 @@ pub fn flatten(db: &T, virtual_path: &Path) -> Result> let like_path = real_path.as_path().to_string_lossy().into_owned() + "%"; let real_songs: Vec = songs .filter(path.like(&like_path)) + .order(path) .load(connection.deref())?; let virtual_songs = real_songs .into_iter() @@ -662,6 +663,7 @@ fn test_flatten() { update(&db).unwrap(); let results = flatten(&db, Path::new("root")).unwrap(); assert_eq!(results.len(), 12); + assert_eq!(results[0].title, Some("Above The Water".to_owned())); } #[test]