From 41a0ea584e1322b3757bdece84ba10f3076f3eb3 Mon Sep 17 00:00:00 2001 From: Andrei Kurosh Date: Fri, 12 Jan 2024 11:11:08 +0100 Subject: [PATCH] Media order fix when sorting by tag count. Closes #268. --- src/Bonsai/Areas/Admin/Logic/MediaManagerService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bonsai/Areas/Admin/Logic/MediaManagerService.cs b/src/Bonsai/Areas/Admin/Logic/MediaManagerService.cs index fdc28d7..d93aa06 100644 --- a/src/Bonsai/Areas/Admin/Logic/MediaManagerService.cs +++ b/src/Bonsai/Areas/Admin/Logic/MediaManagerService.cs @@ -102,7 +102,7 @@ public async Task GetMediaAsync(MediaListRequestVM request) var isDesc = request.OrderDescending ?? false; if (request.OrderBy == nameof(Media.Tags)) - query = query.OrderBy(x => x.Tags.Count, isDesc); + query = query.OrderBy(x => x.Tags.Count(y => y.Type == MediaTagType.DepictedEntity), isDesc); else if (request.OrderBy == nameof(Media.Title)) query = query.OrderBy(x => x.Title, isDesc).ThenBy(x => x.UploadDate, isDesc); else