Chapter.cs remove comparison again and instead check chapterids in RetrieveChaptersJob.cs

This commit is contained in:
Glax 2025-05-18 14:28:07 +02:00
parent 852fbf5ae8
commit 3853e2daa2
2 changed files with 2 additions and 5 deletions

View File

@ -60,9 +60,6 @@ public class Chapter : IComparable<Chapter>
{ {
if (other is not { } otherChapter) if (other is not { } otherChapter)
throw new ArgumentException($"{other} can not be compared to {this}"); 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 return VolumeNumber?.CompareTo(otherChapter.VolumeNumber) switch
{ {
< 0 => -1, < 0 => -1,

View File

@ -43,8 +43,8 @@ public class RetrieveChaptersJob : Job
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load(); context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
// This gets all chapters that are not downloaded // This gets all chapters that are not downloaded
Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language).DistinctBy(c => c.ChapterId).ToArray(); Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language).DistinctBy(c => c.ChapterId).ToArray();
Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Contains(chapter) == false).ToArray(); Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Select(c => c.ChapterId).Contains(chapter.ChapterId) == false).ToArray();
Log.Info($"{newChapters.Length} new chapters."); Log.Info($"{Manga.Chapters.Count} existing + {newChapters.Length} new chapters.");
try try
{ {