From 103a79668c6fc6a98c2b1efd50e7342896e4c0aa Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Sun, 6 Jul 2025 15:11:37 -0700 Subject: [PATCH] fix sorting --- ui/browsing/artistpage.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/browsing/artistpage.go b/ui/browsing/artistpage.go index 623dca5..187e933 100644 --- a/ui/browsing/artistpage.go +++ b/ui/browsing/artistpage.go @@ -248,21 +248,23 @@ func (a *ArtistPage) getGroupedReleasesModel() widgets.GroupedReleasesModel { } func (a *ArtistPage) sortAlbumsSlices(slices ...[]*mediaprovider.Album) { + var curSlice []*mediaprovider.Album sortFunc := func(x, y int) bool { - return a.artistInfo.Albums[y].Date.After(a.artistInfo.Albums[x].Date) + return curSlice[y].Date.After(curSlice[x].Date) } switch a.cfg.DiscographySort { case discographySorts[1]: /*year descending*/ sortFunc = func(x, y int) bool { - return a.artistInfo.Albums[x].Date.After(a.artistInfo.Albums[y].Date) + return curSlice[x].Date.After(curSlice[y].Date) } case discographySorts[2]: /*name*/ sortFunc = func(x, y int) bool { - return a.artistInfo.Albums[x].Name < a.artistInfo.Albums[y].Name + return curSlice[x].Name < curSlice[y].Name } } for _, slice := range slices { + curSlice = slice sort.Slice(slice, sortFunc) } }