From 3853e2daa2c02fbcf0ba893b3a305567a384d311 Mon Sep 17 00:00:00 2001 From: Glax Date: Sun, 18 May 2025 14:28:07 +0200 Subject: [PATCH] Chapter.cs remove comparison again and instead check chapterids in RetrieveChaptersJob.cs --- API/Schema/Chapter.cs | 3 --- API/Schema/Jobs/RetrieveChaptersJob.cs | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/API/Schema/Chapter.cs b/API/Schema/Chapter.cs index ba8d36e..695b826 100644 --- a/API/Schema/Chapter.cs +++ b/API/Schema/Chapter.cs @@ -60,9 +60,6 @@ public class Chapter : IComparable { if (other is not { } otherChapter) throw new ArgumentException($"{other} can not be compared to {this}"); - //Compare Ids for Collection-Comparisons - if(other.ChapterId.Equals(this.ChapterId)) - return 0; return VolumeNumber?.CompareTo(otherChapter.VolumeNumber) switch { < 0 => -1, diff --git a/API/Schema/Jobs/RetrieveChaptersJob.cs b/API/Schema/Jobs/RetrieveChaptersJob.cs index 5d943a4..e020010 100644 --- a/API/Schema/Jobs/RetrieveChaptersJob.cs +++ b/API/Schema/Jobs/RetrieveChaptersJob.cs @@ -43,8 +43,8 @@ public class RetrieveChaptersJob : Job context.Entry(Manga).Collection(m => m.Chapters).Load(); // This gets all chapters that are not downloaded Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language).DistinctBy(c => c.ChapterId).ToArray(); - Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Contains(chapter) == false).ToArray(); - Log.Info($"{newChapters.Length} new chapters."); + Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Select(c => c.ChapterId).Contains(chapter.ChapterId) == false).ToArray(); + Log.Info($"{Manga.Chapters.Count} existing + {newChapters.Length} new chapters."); try {