RetrieveChaptersJob.cs do not use context to access Chapters

This commit is contained in:
Glax 2025-05-16 20:00:53 +02:00
parent a764f381c9
commit adc7ee606e

View File

@ -32,9 +32,10 @@ public class RetrieveChaptersJob : Job
protected override IEnumerable<Job> RunInternal(PgsqlContext context) protected override IEnumerable<Job> RunInternal(PgsqlContext context)
{ {
context.Attach(Manga); context.Attach(Manga);
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); Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language);
Chapter[] newChapters = allChapters.Where(chapter => context.Chapters.Contains(chapter) == false).ToArray(); Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Contains(chapter) == false).ToArray();
Log.Info($"{newChapters.Length} new chapters."); Log.Info($"{newChapters.Length} new chapters.");
try try