mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixed an issue with ordering of chapters within a volume for selecting first cover image. (#529)
This commit is contained in:
parent
599e21fcbb
commit
69ebd09fcd
@ -20,7 +20,7 @@ namespace API.Services
|
|||||||
private readonly IArchiveService _archiveService;
|
private readonly IArchiveService _archiveService;
|
||||||
private readonly IBookService _bookService;
|
private readonly IBookService _bookService;
|
||||||
private readonly IImageService _imageService;
|
private readonly IImageService _imageService;
|
||||||
private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();
|
private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the Thumbnail generation
|
/// Width of the Thumbnail generation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -102,7 +102,7 @@ namespace API.Services
|
|||||||
, false)) return;
|
, false)) return;
|
||||||
|
|
||||||
volume.Chapters ??= new List<Chapter>();
|
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;
|
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 firstCover is null and one volume, the whole series is Chapters under Vol 0.
|
||||||
if (series.Volumes.Count == 1)
|
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;
|
.FirstOrDefault(c => !c.IsSpecial)?.CoverImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasCoverImage(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;
|
.FirstOrDefault()?.CoverImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user