mirror of
https://github.com/agersant/polaris
synced 2024-12-11 22:03:11 +00:00
Fixed a bug where songs weren't sorted correctly in api/flatten
This commit is contained in:
parent
bd537b8134
commit
ad22a3529f
1 changed files with 2 additions and 0 deletions
|
@ -524,6 +524,7 @@ pub fn flatten<T>(db: &T, virtual_path: &Path) -> Result<Vec<Song>>
|
||||||
let like_path = real_path.as_path().to_string_lossy().into_owned() + "%";
|
let like_path = real_path.as_path().to_string_lossy().into_owned() + "%";
|
||||||
let real_songs: Vec<Song> = songs
|
let real_songs: Vec<Song> = songs
|
||||||
.filter(path.like(&like_path))
|
.filter(path.like(&like_path))
|
||||||
|
.order(path)
|
||||||
.load(connection.deref())?;
|
.load(connection.deref())?;
|
||||||
let virtual_songs = real_songs
|
let virtual_songs = real_songs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -662,6 +663,7 @@ fn test_flatten() {
|
||||||
update(&db).unwrap();
|
update(&db).unwrap();
|
||||||
let results = flatten(&db, Path::new("root")).unwrap();
|
let results = flatten(&db, Path::new("root")).unwrap();
|
||||||
assert_eq!(results.len(), 12);
|
assert_eq!(results.len(), 12);
|
||||||
|
assert_eq!(results[0].title, Some("Above The Water".to_owned()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue