Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Fixed an issue with ordering of chapters within a volume for selecting first cover image. (#529)
Joseph Milazzo69ebd09fcdd7
diff --git a/API/Services/MetadataService.cs b/API/Services/MetadataService.csindex fe2a27172..aa175c021 100644--- a/API/Services/MetadataService.cs+++ b/API/Services/MetadataService.cs@@ -20,7 +20,7 @@ namespace API.Servicesprivate readonly IArchiveService _archiveService;private readonly IBookService _bookService;private readonly IImageService _imageService;- private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();+ private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();/// <summary>/// Width of the Thumbnail generation/// </summary>@@ -102,7 +102,7 @@ namespace API.Services, false)) return;volume.Chapters ??= new List<Chapter>();- var firstChapter = volume.Chapters.OrderBy(x => double.Parse(x.Number), _chapterSortComparer).FirstOrDefault();+ var firstChapter = volume.Chapters.OrderBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting).FirstOrDefault();if (firstChapter == null) return;@@ -127,13 +127,13 @@ namespace API.Services// If firstCover is null and one volume, the whole series is Chapters under Vol 0.if (series.Volumes.Count == 1){- coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparer)+ coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting).FirstOrDefault(c => !c.IsSpecial)?.CoverImage;}if (!HasCoverImage(coverImage)){- coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparer)+ coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting).FirstOrDefault()?.CoverImage;}}